NoSQL · Data models · SQL comparison
NoSQL basics: models, SQL comparison and when to use each one
NoSQL is not a single database type and it is not a generic replacement for SQL. It is a family of data models designed for cases where the relational model is not the most comfortable fit: flexible documents, very large distributed datasets, fast key lookups or highly connected relationships.
Quick answer
Use a relational database when the domain depends on strong consistency, joins, tabular reporting and a stable schema. Consider NoSQL when the access pattern, scale or data shape fits one of its models better: key-value, document, column-family or graph.
The four NoSQL models at a glance
Key-value
Stores a value behind a key. Useful for sessions, caches, counters and very fast direct lookups.
Document
Stores JSON-like documents. Useful when the application reads and writes complete aggregates.
Column-family
Optimized for large distributed writes and queries designed around known access patterns.
Graph
Designed for relationships. Useful for recommendations, networks, fraud paths and dependency analysis.
SQL vs NoSQL: the practical decision
Common mistake
The mistake is not choosing SQL or NoSQL. The mistake is choosing a database before knowing how the application will read, write and evolve its data. In NoSQL, modeling starts from the queries and the aggregate boundaries, not only from the entities.
