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
https://forums.phpfreaks.com/topic/185756-add-to-favorites-in-application/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.