Skip to main content

NoSQL term and CAP theorem

Short answer

NoSQL ('Not Only SQL') denotes non-relational databases with flexible schemas and horizontal scaling, trading ACID for BASE. The CAP theorem states a distributed system can guarantee at most two of Consistency, Availability, and Partition Tolerance; since partitions are inevitable, systems choose between consistency (CP) and availability (AP).

Explain the term NO-SQL. Explain CAP theorem with suitable block diagram.

NoSQL

NoSQL stands for "Not Only SQL". It refers to a class of non-relational databases designed for large-scale, distributed data. They do not use the fixed table schema and JOINs of an RDBMS, and they relax some ACID guarantees in return for scalability and availability.

Main features:

  • Schema-less / flexible schema
  • Horizontal scaling over clusters of commodity servers
  • High availability through replication
  • Handles structured, semi-structured and unstructured data
  • Eventual consistency (BASE) rather than strict ACID

Types: key-value, document, column-family and graph. Examples: MongoDB, Cassandra, HBase, Redis, Neo4j.

CAP theorem

The CAP theorem (Eric Brewer, proved by Gilbert and Lynch) states that a distributed data store can guarantee at most two of the following three properties at the same time:

  • Consistency (C): all nodes see the same data at the same time; every read returns the most recent write.
  • Availability (A): every request receives a (non-error) response, even if some nodes are down.
  • Partition tolerance (P): the system keeps working even if the network breaks and nodes cannot communicate.

Since network partitions cannot be avoided in a distributed system, the real choice during a partition is between consistency and availability.

              Consistency
                 /\
                /  \
          CA   /    \   CP
        (RDBMS)/  X  \(HBase,
              /      \ MongoDB)
             /________\
  Availability   AP    Partition
                (Cassandra,  tolerance
                 CouchDB)
CombinationMeaningExamples
CAConsistent and available, but cannot tolerate partitions (single-node or tightly coupled)Traditional RDBMS (MySQL, Oracle)
CPConsistent and partition tolerant; some requests are refused during partitionHBase, MongoDB, Redis
APAvailable and partition tolerant; data may be temporarily staleCassandra, CouchDB, DynamoDB

Example: a bank system chooses CP (never show a wrong balance, even if it has to refuse a request), while a social media feed chooses AP (it is acceptable to show slightly old posts).

✓ Answer checked by Claude Opus 5.5 (high effort)

All Big Data Technologies chapter 4 questions →