VWhen would you choose a relational database over a document store?
Interviewer questionDatabases
Database interviews usually move from the basics (SQL, joins, indexes) to transactions and performance. For the spoken part, the key skill is explaining a technical idea simply, without drawing it on a whiteboard.
Use contrast to make answers clear: "with an index, the database does X; without it, the database does Y". Contrast is easy for the listener to remember and easy for you to say in English.
- ✓Words → phrases → sentences → speaking
- ✓Answer meaning
- ✓Language
Common questions and sample answers
When would you choose a relational database over a document store?
What the interviewer wants to hear. Concrete criteria and the awareness that many systems use both.
Sample answer to practise aloudI choose a relational database when the data has a clear structure and relationships, and when I need strong consistency and transactions, for example orders and payments. SQL also gives me flexible queries, joins and constraints that protect the data. A document store is a good choice when the data is naturally one nested document, the schema changes often, or I need to scale writes horizontally and I can accept simpler queries. In many projects I use both: a relational database as the source of truth and a document store or a search engine for specific reads.
How does an index work, and what does it cost?
What the interviewer wants to hear. The structure, the benefit, the write cost and the column order in composite indexes.
Sample answer to practise aloudAn index is an additional data structure, usually a B-tree, that lets the database find rows without scanning the whole table. It is like the index at the back of a book. It speeds up reads, sorting and joins, but it costs disk space and slows down writes, because every insert and update must also update the index. For a composite index, the order of columns matters, because the database can use only the leftmost part. I create indexes for the real queries, check them with EXPLAIN and remove the ones that are not used.
What does ACID mean?
What the interviewer wants to hear. Four properties explained with one example.
Sample answer to practise aloudACID describes the guarantees of a transaction. Atomicity means that a transaction is all or nothing. Consistency means that it moves the database from one valid state to another, so constraints are respected. Isolation means that concurrent transactions do not see each other's unfinished work, to the degree defined by the isolation level. Durability means that once a transaction is committed, it survives a crash, usually because it is written to a log on disk. A classic example is a money transfer: both the withdrawal and the deposit happen, or neither does.
A query is slow in production. What do you do?
What the interviewer wants to hear. A method: measure, read the plan, fix, verify.
Sample answer to practise aloudFirst I measure, I do not guess. I find the exact query, from the slow query log or monitoring, and run EXPLAIN to see the plan. I look for a full table scan, a missing or unused index, a bad join order or outdated statistics. Often the fix is a better index or a rewritten query. In applications with an ORM, I also check for the N+1 problem, where one request creates hundreds of small queries. After the change, I compare timings with real data volumes, because a query can be fast on a small test database and slow in production.
What are isolation levels, and what problems do they prevent?
What the interviewer wants to hear. Dirty reads, non-repeatable reads and phantoms, and the trade-off with concurrency.
Sample answer to practise aloudIsolation levels control what a transaction can see from other concurrent transactions. Read committed prevents dirty reads, so you see only committed data. Repeatable read also prevents non-repeatable reads: the same row gives the same value inside one transaction. Serializable also prevents phantom reads, where a repeated query returns new rows, and it behaves as if the transactions ran one by one. Higher levels give more safety but lower concurrency. Many databases, such as PostgreSQL, use read committed by default, and I raise the level only for operations where the anomaly would be a real business problem.
How to say the key terms
- SQL
- S-Q-L, or "sequel"
- schema
- SKEE-muh
- query
- KWEER-ee
- ACID
- ASS-id
- normalisation
- nor-muh-ly-ZAY-shun
- transaction
- tran-ZAK-shun
Useful phrases for answering
- The database has to scan the whole table.
- It trades read speed for write cost.
- I would look at the execution plan first.
- That query uses an index, so it is fast.
- In our system, the source of truth is…
- I would measure before I optimise.
Common mistakes to avoid
- Saying "NoSQL is faster". Faster for what? Name the access pattern.
- Adding indexes everywhere. Mention the write cost and that you check the plan.
- Mixing up the C in ACID (valid data rules) with the C in the CAP theorem (consistency across nodes). Say which one you mean.
- Not saying how you verified a fix. Mention the plan, the timing and the data volume.
Frequently asked questions
How much SQL will I write in an interview?
Often a short query on a shared screen or on paper: a join, a group by, sometimes a window function. Say the plan before you write: "First I join orders to customers, then I group by month."
Which database should I say I know best?
The one you really used. PostgreSQL and MySQL are the most common, and you should say how you used them: schema design, tuning and migrations.
Do I need to know database internals?
A simple picture is enough for most roles: B-tree indexes, the write-ahead log and how transactions isolate each other. Deeper knowledge matters for database or data platform roles.
Reading an answer is not the same as saying it. Practise each question out loud, then compare the meaning and the language of your own answer.
Try SpeakRole ↗Other topics in this area