How to choose Sql Or NoSql

Tue, Mar 1, 2022 2-minute read

Using real life cases to understand when to use NoSQL or SQL?

Relational databases in companies

1. startup stage

image

RelationalDatabases

2. upstream traffic will be higher

add more servers, use Nigix as load balancer

image

RelationalDatabases

3. Master-Slave database separate read and write

add more servers, use Nigix as load balancer

image

RelationalDatabases

4. Sharding

larger datasets to be split in smaller chunks and stored in multiple data nodes, increasing the total storage capacity of the system

image

RelationalDatabases


SQL Server provides ACID guarantees.

but, High I/O during peak or maintenance times, not efficient with large volumes of data…


NoSql

image

nosql

image

nosql

Key-Value store NoSql

redis

most common use cases

  • record sessions in applications that require logins.

  • shopping cart

The scalability of key-value stores comes in handy in peak seasons around holidays or during sales and special promotions because there is usually a sharp increase in sales and an even greater increase in traffic on the website. The scalability of the key-value store will make sure that the increased load on the database does not result in performance issues.

document oriented

ElasticSearch

It is a flexible and powerful data storage search engine, Lots of search options

Elasticsearch is built for search and provides advanced data indexing capabilities.

MongoDB

MongoDB is used for storage

Column-oriented NoSql

HBase, Cassandra

Scalability is excellent with column-store databases. They can be expanded nearly infinitely, and are often spread across large clusters of machines, even numbering in thousands. That also means that they are great for Massive Parallel Processing.

Load times are similarly excellent, as you can easily load a billion-row table in a few seconds. That means you can load and query nearly instantly.

Large amounts of flexibility as columns do not necessarily have to look like each other. That means you can add new and different columns without disrupting the whole database. That being said, entering completely new record queries requires a change to all tables.