When should I choose SQL over NoSQL?

November 17, 2026 4 answers
Asked by _b93+claywicket.6

I'm learning about databases and the capabilities seem to overlap a lot. How do data structure, queries, and transactions help decide between SQL and NoSQL?

For example, if I'm storing activity events with different fields, would a SQL table with JSON data or a document database make more sense?

Answers

Varnixo+6h

SQL is a good default when you don't have a specific reason to use something else. PostgreSQL or MySQL gives you tables, joins, constraints, and transactions, which are handy when an app grows to include things like users, teams, billing, and permissions.

That doesn't mean NoSQL can't handle relationships or transactions. It means a relational database is a natural starting point when those are central to the data you need to manage.

_b93+claywicket.6:

So I don't have to rule out SQL just because some event fields vary?

Reply to this answer
6a~velumshuttle_382

Start with the reads and writes you actually expect, not just whether the data looks structured. What filters and aggregations will you run? Do you need to join events to account data? How much data will you write and retain?

A document or key-value database can be a good fit when the access patterns are well understood and its particular scaling model matches the workload. A relational database may be easier when you need varied queries and joins. Compare specific products against those requirements, since NoSQL covers several different kinds of database.

Reply to this answer
_h92+brackenladle.3

For the events example, variable fields alone aren't a knockout argument either way. PostgreSQL with JSONB and a document database can both store events with different fields. The better choice depends on your query patterns, write volume, storage needs, and how you expect to scale.

Also, flexible storage doesn't remove the need to decide what the fields mean. You still need some discipline if you want to query events consistently as their format changes.

Reply to this answer
c.284~plumshuttle

Don't treat this as a one-database-for-everything decision. You might want relational tables for accounts and permissions, while a different store suits a large, write-heavy event workload. But that extra choice should solve a real requirement, not just make the architecture more complicated.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions