MidDatabases

You need to rename a heavily-used database column with zero downtime. How?

What they are really testing: Whether you know expand and contract. This is the question that separates people who have actually shipped schema changes from people who have only read about them.

A real interview question

You need to rename a heavily-used database column with zero downtime. How?

What most people say

drag me

Run ALTER TABLE RENAME COLUMN during a low-traffic window.

It assumes a maintenance window exists and that a single atomic change is safe, but during any rolling deploy both versions of the application are live, so one of them breaks the moment the rename lands.

The follow-ups they ask next

  • Why not just drop the old column in release 3?

    Because rollback needs it. If release 3 has a bug and you revert to code that reads the old column, the data must still be there. Leave a full release cycle between stopping writes and dropping.

  • How do you backfill 200 million rows without hurting production?

    Batch with a throttle, run off-peak, watch replication lag and pause when it grows, make it resumable with a checkpoint, and keep transactions small so you never hold long locks.

What the interviewer is listening for

  • Names expand and contract
  • Batches the backfill and watches replication
  • Keeps every step reversible

What sinks the answer

  • Single atomic rename
  • Assumes a maintenance window
  • Drops the old column too early to roll back

If you genuinely do not know

Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.

A rename breaks [whichever version does not know the new name during rollout]. So [add the new column and write both, read old], then [backfill in batches], then [switch reads], then [stop writing old], then [drop it a release later]. Each step [is independently reversible].

Keep going with databases

All 87 devops engineer questions

Knowing the answer is not the same as recalling it under pressure

Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.

Start free