Intro
NoSQL refers to databases that aren’t relational and don’t use a dialect of SQL. They were developed to solve the shortcomings of traditional relational databases, which struggled with volume, variety, speed, and strict schemas…
NoSQL DBs handle massive amounts of distributed data that don’t necessarily adhere to strict schemas. NoSQL DBs handle lots of types of data models, including Key-Value stores like Redis, document based DBs, wide-column, and Graphs.
They’re greatly suited for fast horizontal scaling, high volumes of data, and very fast retrieval speeds. This is why they’re beloved by startups and small companies that are moving and developing at high speeds.
Usages
Caching
NoSQL DBs are great for caching data that needs to be retrieved quickly and efficiently.
Evolving data
Great for less-strict collections that may include ephemeral, transient, or rapidly evolving data that’s constantly changing and isn’t ideal for relational databases.
Scalibility
NoSQL DBs scale easily to accommodate massive amounts of data and their distributed nature means they’re on hand when there’s demand for that data because servers can be added to the cluster.
Efficiency
The lack of strict models results in more efficient DBs because it removes the need to update data across the entire DB in real time.
Types
Key-value stores
redis
Document databases
Document oriented DBs are very simple and store the data as simple documents in formats such as JSON. Making manipulation and mapping easier than it is in SQL.
A famous example is MongoDB.
Wide-Column stores
Cassandra
Graph databases
Neo4j
Advantages and Disadvantages
Advantages
Scalability
NoSQL DBs scale horizontally, can add more servers or nodes to the database cluster to handle increasing traffic and loads.
Horizontal partitioning and sharding
NoSQL databases support horizontal partitioning and sharding. So data can be distributed across multiple servers or nodes to maintain performance.
Flexibility and schema-less design
Often using schema-less or schema-flexible data model. Perfect for agile development scenarios where the data structure is always evolving and it decreases extra work for database administrators that would need to update these models and schemas…
Performance
NoSQL DBs are optimized for workloads like read-heavy and write-heavy operations. Improving performance for certain tasks.
Distributed and fault tolerant
By distributing data across multiple servers or data centers automatically, NoSQL databases help ensure high availability.
Disadvantages
It’s not all perfect…
No standard query language (duh!)
Each NoSQL DB has it’s own querying method or language.
Smaller communities
Unlike SQL that’s been around for decades and used by all industries in some capacity or another, NoSQL is less supported by enterprise.
Inefficient for complex queries
The lack of structure and schemas shoot complex queries in the foot. This is where SQL has an upper hand, and is what leads to…
No consistency with retrieved data
NoSQL DBs are distributed so they’re fast but the ACID principles go out the window, and the consistency is what takes the biggest hit.