What ways are there to store information about an anonymous/guest user in a database?

后端 未结 8 2443
后悔当初
后悔当初 2021-02-13 15:58

Our application has an online shop among other features, and users are normally requested to register before completing a sale, creating a unique customer_ID in the

8条回答
  •  滥情空心
    2021-02-13 16:21

    I would create a unique customer ID, and store it on the user's machine as a cookie. This should decrease the number of users with multiple customer IDs.

    But in all seriousness, as long as your number of ids isn't getting into the hundreds of thousands (and congrats if it is!), it's not going to hurt your database as long as you have proper indexes on the customer id column.

    If you had id=0 for each customer wouldn't you have just as many rows though? I think that's inescapable if you want to keep all the data, right? A zero id might cause your index extra problems too.

提交回复
热议问题