Jump to content

Dealing with large friends list?


Eggzorcist

Recommended Posts

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?

Link to comment
Share on other sites

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.

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.