Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database design for a social networking site

People also ask

What database is used for social networking sites?

If the database is going to be embedded in the application, then SQLite would be ideal. If the database is going to house the communication data of the users, then you'll need a back-end platform. Facebook uses MySQL. PostgreSQL is ACID compliant.

Which database does Facebook use?

At Facebook we use MySQL to manage many petabytes of data, along with the InnoDB storage engine that serves social activities such as likes, comments, and shares.


Try having a look at Database Answers in particular the data models. They have several different designs for various systems. This one is for a social networking site which may give you an idea of what's required.

You may want to search on SO for other social network database questions. I found this one that had a link to flickr showing a schema which appears to be from Facebook.

Your database design will be based around your system requirements. Without knowing exactly what you are trying to achieve, it is difficult to give you the best design.


you can use this Messenger Database Design Concept: Messenger DB

Messenger DB Schema


You can create a separate table for follower/ followed relationships. So, when x follow y, create an entry with follower_id = x.id followed_id = y.id.

You can query the relationship table to look for all the users x has relations with by select * from relationships where follower_id = x.id or vice versa.

When/if x un-follow y, you just have to delete the entry you originally created.