Data, ORMs and caching · core
SQL vs NoSQL: choosing a database
Relational databases (Postgres, MySQL) store data in tables with a schema, joins and strong transactions; NoSQL stores like MongoDB (documents), Redis and DynamoDB (key-value) trade some of that for flexible shapes or simple fast access by key, so you choose by data relationships and access patterns.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- SQL: fixed schema, joins, constraints (foreign keys, unique), ACID transactions, rich ad-hoc queries. Default choice for business data (orders, payments, users).
- Document (MongoDB): flexible JSON-like documents, nested data read in one go, transactions exist but joins ($lookup) are weaker; good when you read a whole aggregate together and the shape varies.
- Key-value (Redis, DynamoDB): get/put by key, extremely fast and scalable; you must design keys around known queries; poor at ad-hoc queries.
- Others: search engines (Elasticsearch/OpenSearch) for full-text, time-series stores for metrics, graph databases for relationships.
- Scaling: SQL scales up well and out with read replicas and partitioning; many NoSQL systems partition by key from the start.
- Postgres covers a lot (JSONB documents, full-text search), so 'Postgres plus Redis' is a common, sensible default.
The red pen
Common traps: mistake → fix
Mistake: NoSQL means no schema
Fix: the schema moves into your code; you still need to design it.
Mistake: SQL databases cannot scale
Fix: large companies run huge Postgres/MySQL fleets with replicas and sharding.
Mistake: MongoDB has no transactions
Fix: it has multi-document transactions; the design question is joins and access patterns.
Easy to hard
Questions interviewers ask, easy to hard
- SQL vs NoSQL: what is the difference and when do you pick each?
- MongoDB vs MySQL for an e-commerce order system?
- How would you store a product catalogue with very different attributes per category?
- Which database for: sessions, payments, chat messages, product search?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.