HACKER Q&A
📣 hieu229

NoSQL or SQL database for a social media app?


Hi guys,

I'm building a social media mobile app (and potentially available for web).

As any social media app, there are a lots of relation data queries involve. For example, user follow authors, author create posts, post belong to topics.

Would it be much better to use SQL over NoSQL database in this case? Or maybe a mix of both?

Considering ease of development, the performance, and number of request trips. Such as checking if: - The current user is following an author (in a post page or author's profile page) - The current user has liked or bookmarked a post (in a post page)

Also, there are a number of querying recommendations for posts and authors for a user behind the sense.

Please share your advice if you have experienced in both NoSQL and SQL databases with similar project. Any database recommendation in particular?

Many thanks!


  👤 dith3r Accepted Answer ✓
Use a database you know the best. Yours data looks like it is a natural fit for a graph. graphs could be implemented on top of many sql or nosql dbs.

👤 Raziarazzi
It depends on what you're trying to do. If you're just storing user data, then SQL is fine. But if you need to store a lot of information about each user, like their posts or comments and the corresponding metadata (like who they're replying to), then NoSQL databases are better because they're optimized for that kind of structure.

👤 fulafel
NoSQL just means something that's not a SQL DB. But the set of databases outside of that set is very large and various.

Think about your requirements and then consider various databases, keeping the "sql" feature as just one dimension.

(To make things more confusing, you can actually query many "NoSQL" databases using SQL with some SQL middleware)