wasAsked.

How would you migrate a large SQL table with near-zero downtime in a .NET application?

CRED · Full Stack Developer · 3-4-years · technical

Published

Year not specified · .NET, SQL, DevOps

Community answers

Posted by wasAsked editorial collection

Use expand-and-contract. First add nullable columns, new tables, or indexes without changing existing behavior. Deploy code that reads both formats and writes compatibly, backfill in small resumable batches, verify counts/checksums, switch reads, then enforce constraints and remove old structures in a later release. Avoid one huge transaction and table-rewriting operations during peak traffic. Estimate locks and log growth, set timeouts, throttle batches, monitor blocking/replication, and have explicit pause/rollback criteria. For tenant data, every backfill and verification query must preserve RestaurantId and OutletId. Back up and rehearse on production-sized data; an application rollback cannot undo an incompatible schema change.

Backbencher Developer · · 0 likes

Sign in to add your answer

Related interview topics