Eggzorcist Posted June 24, 2012 Share Posted June 24, 2012 Hi everyone. I'm making a social media type app and was wondering how to deal with large amounts of friends per user. My first guess was to create a large text field where I append all the names the person is friends with. Similarly to this: (friend1, friend2, friend3) Though I feel as though this isn't the best and more efficient way to go about it. THen I thought maybe I should create a new table entirely of maybe 3 fields containing (id, friend1, friend2). Where then I can fish out who's friends with who. I'm wondering if there is any way, or better way. And which of the two is the best way? How does a site like Facebook deal with this? Thank you? Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 24, 2012 Share Posted June 24, 2012 Although it may seem counter intuitive what you want is a single record for each friend association. So, if a user has five friends there will be five records in the friends table. If you put many fried records into a single field you cannot do appropriate searches. And, having multiple columns ina table wont scale. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.