Full Stack Developer Interview Question

How would you rename a column on a table with 50 million rows with no downtime?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

Expand, migrate, contract. Add the new column, deploy code that writes both and still reads the old one, backfill in throttled batches, then flip reads to the new column in a separate deploy, and only drop the old column once nothing references it. Never combine a schema change and a code cutover in one release, because you lose the ability to roll back cleanly.

Why interviewers ask this

This tests whether you have shipped migrations against live traffic or only run them locally. The interviewer wants the multi deploy sequence, awareness of locking behavior on large tables, and a rollback story. Candidates who answer with a single ALTER statement have usually never watched a migration take an exclusive lock and stall every request on a production database at peak.

How to structure your answer

  • Name the expand and contract pattern up front.
  • Walk the deploys in order with what each one does.
  • Explain how you backfill without locking or saturating the database.
  • State the rollback position at each step.

Example answer

Spoken example, first person

A rename is really a sequence of small safe changes rather than one statement. First deploy adds the new column as nullable, which is cheap in Postgres because it does not rewrite the table, and ships code that writes to both columns while still reading the old one. Then I backfill in batches, maybe five thousand rows at a time with a short sleep, watching replication lag and lock waits, so I am never holding a long transaction. Second deploy switches reads to the new column, with the dual write still in place so I can revert instantly if something is wrong. Only after that has been stable for a few days does the third deploy stop writing the old column and drop it. The reason I insist on separate deploys is rollback. If the schema change and the code change ship together, reverting the code leaves the database in a shape the old code cannot read. I also add indexes concurrently and set a lock timeout so a migration fails fast instead of queueing behind a long query and freezing writes.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • Which of those steps takes a lock in Postgres, and how long?
  • How would you verify the backfill is correct before flipping reads?
  • What is your rollback if the backfill is halfway done?

Related full stack developer questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot