mysqldatabasedatabase-designrdbmssocial-networking

Friend Relationships in a Social Network


I think instead of maintaining a single friendRelations table containing a list of relations of all users on my network it would be better to make a separate Relations table for each user on network, that contains profileIDs of all people & groups the user chooses to follow.

This way retreival would be quite faster...


Solution

  • Remember that databases are generally quite good at indexing (assuming you give them suitable columns to index) so retrieval for a specific user should be fast in any case. Creating a bazillion tables may be slower overall.