What is NoSQL

NoSQL is a non-relational DBMS, that does not require a fixed schema, avoids joins, and is easy to scale. NoSQL database stands for “Not Only SQL” or “Not SQL.” Though a better term would be “NoREL”, that is no relational.

A NoSQL database includes simplicity of design, simpler horizontal scaling to clusters of machines and finer control over availability. The data structures used by NoSQL databases are different from those used by default in relational databases which makes some operations faster in NoSQL. The suitability of a given NoSQL database depends on the problem it should solve. Data structures used by NoSQL databases are sometimes also viewed as more flexible than relational database tables.

The advantages of NoSQL don’t come without a cost, though. NoSQL systems don’t generally provide the same level of data consistency as SQL databases. In fact, while SQL databases have traditionally sacrificed performance and scalability for the ACID properties behind reliable transactions, NoSQL databases have largely ditched those ACID guarantees for speed and scalability.

In short, SQL and NoSQL databases offer different tradeoffs. While they may compete in the context of a specific project—as in, which to choose for this application or that application—they are complementary in the bigger picture. Each is suited to different use cases. The decision is not so much a case of either/or as it is a question of which tool is right for the job.

Types of NoSQL Databases

There are mainly four categories of NoSQL databases. Each of these categories has its unique attributes and limitations. No specific database is better to solve all problems. You should select a database based on your product needs.

Let see all of them:

  • Key-value Pair Based
  • Column-oriented Graph
  • Graphs based
  • Document-oriented

Document databases (e.g. CouchDB, MongoDB). Inserted data is stored in the form of free-form JSON structures or “documents,” where the data could be anything from integers to strings to freeform text. There is no inherent need to specify what fields, if any, a document will contain.Document oriented

Key Value Pair Based(e.g. Redis, Riak): Data is stored in key/value pairs. It is designed in such a way to handle lots of data and heavy load.

It is one of the most basic types of NoSQL databases. This kind of NoSQL database is used as a collection, dictionaries, associative arrays, etc. Key value stores help the developer to store schema-less data. They work best for shopping cart contents.

Wide column stores (e.g. HBase, Cassandra). Data is stored in columns instead of rows as in a conventional SQL system. Any number of columns (and therefore many different types of data) can be grouped or aggregated as needed for queries or data views.

Column oriented

Graph databases (e.g. Neo4j). A graph type database stores entities as well the relations amongst those entities. The entity is stored as a node with the relationship as edges. An edge gives a relationship between nodes. Every node and edge has a unique identifier.

 

What is the CAP Theorem?

CAP theorem is also called brewer’s theorem. It states that is impossible for a distributed data store to offer more than two out of three guarantees

  1. Consistency
  2. Availability
  3. Partition Tolerance

Consistency: The data should remain consistent even after the execution of an operation. This means once data is written, any future read request should contain that data. For example, after updating the order status, all the clients should be able to see the same data.

Availability: The database should always be available and responsive. It should not have any downtime.

Partition Tolerance: Partition Tolerance means that the system should continue to function even if the communication among the servers is not stable. For example, the servers can be partitioned into multiple groups which may not communicate with each other. Here, if part of the database is unavailable, other parts are always unaffected.

Eventual Consistency

The term “eventual consistency” means to have copies of data on multiple machines to get high availability and scalability. Thus, changes made to any data item on one machine has to be propagated to other replicas.

Data replication may not be instantaneous as some copies will be updated immediately while others in due course of time. These copies may be mutually, but in due course of time, they become consistent. Hence, the name eventual consistency.

BASE: Basically Available, Soft state, Eventual consistency

  • Basically, available means DB is available all the time as per CAP theorem
  • Soft state means even without an input; the system state may change
  • Eventual consistency means that the system will become consistent over time

Advantages of NoSQL

  • Big Data Capability
  • No Single Point of Failure
  • Easy Replication
  • No Need for Separate Caching Layer
  • It provides fast performance and horizontal scalability.
  • Can handle structured, semi-structured, and unstructured data with equal effect
  • NoSQL databases don’t need a dedicated high-performance server
  • Simple to implement than using RDBMS
  • Excels at distributed database and multi-data center operations

Disadvantages of NoSQL

  • No standardization rules
  • Limited query capabilities
  • RDBMS databases and tools are comparatively mature
  • It does not offer any traditional database capabilities, like consistency when multiple transactions are performed simultaneously.
  • When the volume of data increases it is difficult to maintain unique values as keys become difficult
  • Doesn’t work as well with relational data
  • The learning curve is stiff for new developers

 

Leave a comment

Create a free website or blog at WordPress.com.

Up ↑

Design a site like this with WordPress.com
Get started