SQL Vs NoSQL
- In general case, choose Database/SQL because they've been arround for a while
- Schema logic is both doable in Database/SQL and NoSQL
- Choose NoSQL if your application
- require super low latency
- unstructured, doesn't have any relational data
- you only need to deserialise and serialise data (JSON, XML, YAML)
- Trash data that can be safely discarded at some points (logging, session storage)
- Choosing NoSQL is very risky. For example in MongoDB. When you write a data, the data is staged to write at a later time.
- Now what happens if it can't write later?
- It doesn't guarantee consistency
- Database/SQL is harder to scale horizontally because of CAP theorem but doesn't mean it's not scalable. Scalability is a very complicated topic
- SQL follows ACID which given consistency. When horizontally scaled and network failure happens. It sacrifices Availability by terminating the whole transaction
- Join table is harder to scale horizontally given the join table and main table are in different instances
- NoSQL is easier to scale horizontally (sharding)
- Now there is NewSQL that supports Horizontally scalability for SQL
Performance
NoSQL has better performance comparing to SQL: Paper.pdf (rochester.edu)