[Q] SQL or NoSQL Databases for this project?

I would like to know what’s the best option to use in the end.

I know that each has it’s own uses but I cannot decide.

I want to create a Web-App in NodeJS + React which will pull the following data:

  • Live User Location

  • User Information such as residence, username, email address and his current location

  • User comments, location, location with other users

  • What the user has bought

As you can understand, my app will depend on Relationships (Show me the Comments of User ID #),

should I go with SQL and POstgreSQL or should I use NoSQL like MongoDB?

The last time I was faced with this problem, I found this article pretty helpful: https://www.sitepoint.com/sql-vs-nosql-choose/

In general, I think the NoSQL vs SQL debate boils down to the rigidity of your data.

1 Like

If you have a choice and you’re not sure you generally can’t go wrong with postgres; it will do almost anything you want with minimal fuss and is extremely solid. IMO NoSQL is an optimisation for certain specific usecases, but YMMV

1 Like

Generally SQL is fine, and even better for most use-cases, but there if your working on side projects NoSQL can be cheaper to run due to the abundance of free database data. Database hosting with Mongo Atlas is free up to 500mb.

NoSQL can handle relational data almost as well as SQL. The flexbility is great for changing data setups, but there is almost no scenario where a well defined, well structured SQL database can’t out-perform a SoSQL one.

Finally, if you want to do this project just for learning use the one you want to learn. SQL is usually more popular with most companies, and NoSQL is more popular with smaller companies and startups due to the flexibility it provides.

I am interested in this as well. With my limited knowledge of NoSQL I have interpreted it like this:

For long term storage I should use PostgreSQL
For caching and static lookup tables I should use NoSQL (Mongo / Redis)

I am using PostgreSQL today for critical data and it is very stable, but I am planning to investigate Redis for caching sessions, lookup tables and similar static or temporary purposes.

Any advices?

I would say it all depends on the structure of your data. In most of the cases, production level apps would use multiple databases often combining SQL and NoSQL to their needs. Consider message type in Whatsapp (or similar) - it has uncertain type, because it could be a text, audio recording, video, location or contact. When you have such types - go with NoSQL, at the same type very stable data, like user credentials might go to SQL database.

Since the data state above is well-structured, I would recommend you using SQL databases, as they are best for structured data. However, MySQL and other similar databases usually lack flexibility.
I would recommend you readin this guide before choosing your solutions.