Page 1 of 1

myspace type DB for managing friends

Posted: Mon Aug 14, 2006 1:37 pm
by GeXus
I'm working on a project that will have a similar DB to how myspace manages friends.

I'm trying to determine the best way to build this out, as one user could potentially have hundreds of thousands of friends...

Would it be best to create an ID table that simply holds the UserID and the UserID of the friend? OR would it be best to just use longtext and hold all friends UserIDs in an array for a paticular user?

Any help would be great... thanks!

Posted: Mon Aug 14, 2006 1:39 pm
by feyd
Never use longtext (or any similar storage type) to hold multiple references.

The former is preferred.

Posted: Mon Aug 14, 2006 2:01 pm
by GeXus
feyd wrote:Never use longtext (or any similar storage type) to hold multiple references.

The former is preferred.
With creating an ID table there could potentially be millions of records really... is that really the most efficient way?

Posted: Mon Aug 14, 2006 2:06 pm
by feyd
It is the correct way and most flexible way. With a longtext you have a VERY finite amount of references to users. Depending on how they are stored, the number available would literally vary because some identifiers are longer than others.. user 123 vs user 123456 for example.

Posted: Mon Aug 14, 2006 3:30 pm
by GeXus
Gotcha! Thanks alot :)