mysqldatabasedatabase-designrdbmssocial-networking

critique of making a separate friend relations table for each user for a social network app


What is a critique of making a separate friend relations table for each user for a social network app?

Instead of maintaining a single FriendRelations table containing a list of relations of all users it would be better to make a separate Relations table for each user that contains profileIDs of all people & groups the user chooses to follow.

This way retrieval would be 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.