Skip to the page

NoSQL and MongoDB · Trade-off

SQL or NoSQL

The interviewer asks

For a new feature, how do you decide between a relational database and a NoSQL one? Give me one example where you'd pick each.

Then

Follow-ups the interviewer asks next

  1. Is "NoSQL scales better" true?
  2. What would you use for a chat app's messages, and why?
  3. What do you give up moving from PostgreSQL to DynamoDB or Cassandra?
  4. Where do distributed SQL databases like TiDB, CockroachDB or YugabyteDB fit?
  5. Zomato moved its billing platform from TiDB to DynamoDB. What kind of access pattern makes that sensible?

The answer

What a strong answer covers

  • Decides on data shape, access patterns, consistency and transaction needs, scale, and what the team can run, not on "SQL doesn't scale".
  • Relational: relationships, ad-hoc queries, strong consistency, multi-row transactions; orders, payments, inventory.
  • Document (MongoDB): nested data read together, changing shape; catalogs, content, profiles. Key-value (Redis, DynamoDB): access by known key at large scale; sessions, carts. Wide-column (Cassandra, ScyllaDB): heavy writes with time order; messages, events. Graph (Neo4j): relationship queries such as fraud rings. Search engines and time-series stores for their own jobs.
  • Costs of NoSQL: you model per query, copy data, have few or no joins, and choose consistency per read or write; DynamoDB needs the access patterns known up front.
  • The lines blur: PostgreSQL has JSONB; MongoDB has multi-document transactions; distributed SQL keeps SQL and transactions with horizontal scale, at the cost of latency and operations.
  • Zomato's billing: high-volume, key-based ledger and payout events with known queries suit DynamoDB.

The red pen

Common traps

Avoid:"NoSQL has no schema, so no design needed"; choosing MongoDB for money movement without thinking about transactions.

Practise this out loud

Say your answer out loud to an AI interviewer that follows up, and get a score for it.

Practise by voice

Practise questions like this out loud

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview