SQL vs NoSQL Is the Wrong Question. Here Is the Right One.
by Arif Ikhsanudin, Backend Developer
The Wrong Starting Point
"Should we use SQL or NoSQL?" is the wrong first question because it groups fundamentally different systems under each label and implies the choice is about the technology category rather than the specific requirements.
"NoSQL" covers DynamoDB (key-value/document, horizontally sharded, eventual consistency), Cassandra (wide-column, distributed, tunable consistency), MongoDB (document, flexible schema), Redis (in-memory key-value), and Neo4j (graph). These systems have almost nothing in common except not being relational. Asking "should we use NoSQL" is like asking "should we use a non-hammer tool" — the answer depends entirely on what you are trying to build.
The right question is: what are your access patterns, and which data model and consistency trade-offs match them?
The Questions That Actually Matter
What are your primary access patterns? How will you query this data? If you need flexible ad-hoc queries across multiple dimensions — filter by date, then by category, then by user — a relational database with indexes is the right tool. If every query is "give me all items for user X" and nothing else, a key-value store with user ID as the partition key handles this with lower latency and better horizontal scale.
What is your consistency requirement? PostgreSQL gives you serializable isolation — the strongest consistency guarantee available. Every read sees the result of every preceding committed write. DynamoDB with eventual consistency gives you lower latency and higher availability but a window where reads may return stale data. Cassandra lets you tune consistency per operation with its CL (consistency level) settings.
If your data model requires strict consistency — financial transactions, inventory reservations, anything where a phantom read or write skew would cause a real problem — you want a relational database with proper transaction isolation. If consistency can be eventual and availability is the priority, distributed NoSQL systems are competitive.
How does your data model evolve? Relational schemas require explicit migrations. Adding a column to a table with 100 million rows is an operational event requiring planning. Document databases (MongoDB) allow schema-flexible documents — you can add new fields to new documents without migrating old ones. This is useful when different records genuinely have different shapes. It is dangerous when the schema flexibility leads to inconsistent document structures that make querying and application code complex.
What is your team's operational experience? PostgreSQL is well-understood, has excellent tooling, and has decades of operational patterns documented. Running a Cassandra cluster correctly — understanding compaction strategies, tombstone handling, consistent hashing — requires specialized knowledge. Choosing Cassandra for a team that has not run it before is taking on significant operational risk. DynamoDB offloads operational burden to AWS at the cost of vendor lock-in and a query model that requires careful upfront design.
When Relational Is Clearly the Answer
Relational databases win when: you need ACID transactions across multiple tables, your access patterns are not fully known at design time (ad-hoc queries are important), your data has complex relationships that benefit from joins, and you value correctness guarantees over raw throughput at extreme scale.
For most B2B applications, internal tools, and systems that do not have genuinely extreme write throughput requirements (millions of writes per second), PostgreSQL handles the load and the relational model reduces application complexity. PostgreSQL with good indexing, connection pooling, and read replicas scales to significant load.
When a Specialized Store Is the Answer
Choose a specialized non-relational store when you have a specific access pattern that a general-purpose relational database handles poorly:
- High-velocity time-series data (IoT sensor data, application metrics): TimescaleDB or InfluxDB
- Graph traversal (social networks, recommendation engines): Neo4j or Amazon Neptune
- Full-text search: Elasticsearch or OpenSearch — not as a primary store, as a search index alongside a primary relational store
- Session storage and hot-path caching: Redis
- Document data with no relational requirements and need for extreme horizontal scale: DynamoDB or MongoDB
The pattern: relational as your primary store, specialized stores for specific access patterns the relational database handles inefficiently. Not the inverse.
The decision is not SQL vs NoSQL. The decision is: which data model, consistency model, and operational profile matches this specific access pattern?