Definition
NoSQL (Not Only SQL) refers to non-relational database management systems that provide mechanisms for storage and retrieval of data modeled in means other than tabular relations used in relational databases.
Overview, Types, Use Cases & Comparison with RDBMS
Instructor: Mohsin F. Dar
Assistant Professor, Cloud & Software Operations Cluster | SOCS | UPES
M.Tech. - Database Systems | First Semester
NoSQL (Not Only SQL) refers to non-relational database management systems that provide mechanisms for storage and retrieval of data modeled in means other than tabular relations used in relational databases.
The simplest NoSQL database model. Data is stored as a collection of key-value pairs where a key serves as a unique identifier.
Store data as documents (typically JSON, BSON, or XML). Each document is self-contained and can have a different structure.
Store data in columns rather than rows. Optimized for queries over large datasets. Data is stored in column families (groups of related columns).
Store data as nodes, edges, and properties. Optimized for relationship-heavy data and traversal queries.
A distributed database system can provide at most TWO out of three guarantees simultaneously:
All nodes see the same data at the same time. Every read receives the most recent write.
Every request receives a response, without guarantee that it contains the most recent data.
The system continues to operate despite network partitions between nodes.
| Database Type | CAP Choice | Example |
|---|---|---|
| MongoDB | CP (Consistency + Partition Tolerance) | Prioritizes consistency over availability |
| Cassandra | AP (Availability + Partition Tolerance) | Eventually consistent, always available |
| Redis | CP with AP options | Configurable based on use case |
| Neo4j | CA (when no partitions) | Strong consistency in cluster |
| Aspect | RDBMS | NoSQL |
|---|---|---|
| Data Model | Tables with fixed schema, rows and columns | Flexible: documents, key-value, graphs, columns |
| Schema | Fixed, predefined schema (schema-on-write) | Dynamic, flexible schema (schema-on-read) |
| Scalability | Vertical scaling (scale-up) | Horizontal scaling (scale-out) |
| Transactions | ACID compliant (Atomicity, Consistency, Isolation, Durability) | BASE (Basically Available, Soft state, Eventually consistent) |
| Query Language | SQL (Structured Query Language) | Varies by database (MongoDB Query Language, Cypher, etc.) |
| Relationships | Complex joins, foreign keys, normalized data | Denormalized, embedded documents, or graph edges |
Database: DynamoDB (Key-Value)
Use: Shopping carts, session management, product catalog
Why: High availability, scalability, microsecond latency
Database: Cassandra (Column-Family)
Use: Inbox search, user activity logs
Why: Write-heavy workloads, massive scale
Database: Cassandra + PostgreSQL
Use: User playlists, recommendations, metadata
Why: Polyglot persistence for different needs
Database: Graph Database
Use: Professional network, connections, recommendations
Why: Complex relationship queries
Database: Cassandra + Others
Use: Viewing history, recommendations, user preferences
Why: Global distribution, high availability
Database: RDBMS (Oracle, DB2)
Use: Transactions, account management
Why: ACID compliance critical for financial data
| Requirement | Choose RDBMS If... | Choose NoSQL If... |
|---|---|---|
| Data Structure | Structured, relational | Unstructured, semi-structured, hierarchical |
| Scalability | Vertical scaling sufficient | Need horizontal scaling |
| Consistency | Strong consistency required | Eventual consistency acceptable |
| Schema | Stable, well-defined | Evolving, flexible |
| Volume | Moderate data volumes | Big Data, high velocity |
Modern applications often use polyglot persistence – combining multiple database types to leverage the strengths of each. The key is understanding your data, access patterns, and business requirements.