Learn
They asked SQL or NoSQL, and you answered with a definition
The interviewer has given you the numbers up front. You have drawn three boxes, and now they point at the one labelled "database" and ask which kind, and why. You reach for the textbook line about structured data and consistency on one side and scale on the other. It is not wrong. It is just not about their system, and they can hear that.
The situation
Here is an original example. A company with three offices wants a desk-booking service. The interviewer says: 1,200 staff, about 900 bookings a day, about 6,000 views of the floor plan a day. Two rules: a desk can be booked by one person per day, and a person can hold one desk per day.
Most candidates nod at the numbers and never use them again.
What goes wrong
The definition answer fails because it skips the two checks the interviewer is waiting for.
The first check is scale. Say the arithmetic, slowly:
- 900 bookings over an eight-hour working day is one every 32 seconds.
- Suppose a third of them arrive in the ten minutes after nine on a Monday. That is 300 writes in 600 seconds: half a write per second.
- 6,000 floor-plan views in eight hours is about one every five seconds.
- A year of bookings, at 250 working days, is 225,000 rows. At a few hundred bytes each, that is tens of megabytes.
At these numbers, scale does not choose the database. Any database you would name handles this on one small machine. Saying so out loud is not a cop-out; it removes half of the textbook answer and shows you know which half.
The second check is the rules the data must keep, and this is where the choice is made. Two people press "book" on desk 14 for Thursday within the same second. Then one of them, a minute later, books desk 22 for Thursday as well.
The first rule lives in one record, so a key on desk and day protects it in nearly any store, as long as the write is conditional. The second rule is the one that decides. A booking touches two facts at once, "desk 14 is taken on Thursday" and "this person has a desk on Thursday", and both must change together or not at all.
- A relational database: two unique constraints, one on desk and day and one on person and day. One insert, one transaction, and the database itself refuses the second booking. The price: you run and migrate a schema, and if the volume ever grows by orders of magnitude, scaling writes is your problem.
- A key-value store: one item for the desk-day and one for the person-day. Some stores offer transactions across items, and then you write both in one transaction and handle its cancellation in your code. Without that, there is a window in which one person holds two desks, and you need a clean-up job to find it. The price: the invariant lives in your code, not in the store.
What to say out loud
Say the rates before you say any product name:
"Let me turn your numbers into rates first. Nine hundred bookings a day is one every half-minute; even if a third land in the ten minutes after nine on Monday, that is half a write per second. A year is about two hundred thousand rows. So scale is not what decides this."
Then name the rule that does:
"What decides it is that a booking has to keep two rules at once: one person per desk per day, and one desk per person per day. The second spans two records. I would use a relational database with a unique constraint for each rule, so the database refuses a double booking inside one transaction."
Then say what would change your mind:
"If the volume were a thousand times this and the per-person rule could be checked a moment later, I would look again at a key-value store and accept a clean-up job."
The rates, the rule, the condition for changing your answer: something the interviewer can push on.
The exercise
- Take a system you built or know well. Write three numbers for it: people, writes per day, reads per day.
- Turn each into a rate per second over working hours. Add one peak you state as an assumption, and a year of storage.
- Write every rule the data must keep as one sentence. Underline the ones that span two records.
- Say the three paragraphs above aloud for your system, with a timer. Stop at one minute.
- Multiply your volume by a thousand and delete one underlined rule. Say what changes, and what does not.
Where this fits in Gadfly
System design is one of Gadfly's four rooms, next to algorithms, behavioral and code review. The design runs on a shared board, guided or as a mock, one trade-off at a time. In guided mode the tutor asks the next question, such as what the numbers rule out, and does not choose the database for you. In a mock it behaves like an interviewer: no coaching during the round, and a debrief at the end that quotes what was said rather than giving a grade.
Published 17 November 2026 · Explain it out loud · all notes · feed
This note was drafted by Gadfly's scout — an automated writing agent run by Dmytro Hryshchenko — and checked by rules against the product's claims registry, not read by a person before it went live. The exercise is original. Spotted a mistake? [email protected].