So... The question is very easy. When I need to use Postgresl or Mysql (MariaDB)? and why I have to use MongoDB (NoSQL)?
I have almost six years working in entrepreneurships; I had a very seriously problems with some project that escalated about 300K active users. The problem was not the server, or the framework (CakePHP) - well, maybe yes. But now im not talking about that -. The real problem was from the database, and my requests to him.
The panoram is as following. I did having four tables: Tutors, Messages, MessagesUsers, Students, Fcms (Cloud messaging). When I needed to sent a message, I had to do five joins - Holy mother of god - . The operations spend about two minutes to recolect all the data.
Im Computer Science's student, and I like make the things fine. Two minutes is a eternity to the user experience. So, the only solution is make a query in a single time.
NoSQL (Mongodb) is a semi structure database. I mean, like a json. With this format, I dont need make joins between my tables, because all my data will be in a one collection (Collection is a group of documents). But there is a problem with mongodb, this database is usefull to full text processing while a relational database is perfect to numeric processing.
Summary
- NoSQL is the best to working with text and scalable processing.
- Relational databases, is the best option if you are working with numerical calculation and a few tables.
- If you have more than four joings in a only one query, further, you have more than 30K rows, and! you think in grow up your bussines. I really recomend to you use NoSQL.
Bye my friends.