Layer 3 · Go deeper · 7 min
Go deeper
Size it, build it, then make the calls an interviewer will push you on.
Back of the envelope
Size it up
Tap through each step of the arithmetic.
What does a DELETE of the oldest month cost?
Build-up · 6 steps
Inside a partitioned table
The parent stores nothing. Partition bounds route every write, prune every read, and turn retention into dropping a table.
Step 1 of 6
One parent, no storage
Your SQL names upi_txn, declared PARTITION BY RANGE (created_at). The parent holds no rows of its own; it knows only its partitions and their bounds.
4 interview moments
You’re the candidate
The interviewer pushes on the hard parts. Pick an approach and see how it holds up.
Deep dive 1 of 4
Interviewer
“Your one primary can’t keep up with inserts at peak. A teammate proposes partitioning the payments table by month. What do you say?”
Your move. Pick an approach:
Deep dive 2 of 4
Interviewer
“Compliance says keep 13 months of payments. How do you remove the oldest month, 300 million rows, every month?”
Your move. Pick an approach:
Deep dive 3 of 4
Interviewer
“You range-partition payments by created_at, 300 million rows a month, 13 months kept. Daily, weekly or monthly partitions?”
Some frequent lookups arrive by txn_id alone, with no date.
Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“Your partitioned payments table’s key is (txn_id, created_at). A retried payment gets a fresh now(). How do you stop a duplicate?”
Your move. Pick an approach: