Jump to content

Add to favorites in application


keldorn

Recommended Posts

I'm building an application, I wanted to add the ability of the user to favorite stuff. What is good way to go about storing the favorite data? I'm thinking here, making a table for each user is not a good idea, I really trying think how sites like Youtube do this without scaling issues,  would you save all their favorites in an Array and serialize it in the 1 row along with their username? Then when you need just unserislize and it and iterate over it, Is that how places like Youtube does it?

 

or create 1 big table dump for all favorite of everybody and just have it sorted from userid=>user recursion?

 

Like

id + user_id + favorite_id

 

THen just do

SELECT favorite_id FROM favorites where user_id=$userid

Link to comment
Share on other sites

I'd just have a table called favorites with two fields: user_id and stuff_id.

 

So you think that would scale?  I wonder how say Youtube handles it, imagine they million of users, with each say 100 favorites, that would be potntional hundreds of millions of row in a table. I dont see it working. Maby on a small scale.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.