TRENDING

TECHNOLOGY NEWS FROM AROUND THE WORLD

→
Near-zero-downtime database migrations with expand-contract
Software Engineering · 2020
Software Engineering2020

Near-zero-downtime database migrations with expand-contract

Changing a production database schema can be harder than running a migration command. In continuous-delivery systems around 2020, old and new application versions commonly overlapped during deployment.

Yazılımcının GünlüğüPublished: Nov 17, 20263 min read
JOIN THE DISCUSSION
✎ Write a comment
Reading progress0%

Historical and technical context

Changing a production database schema can be harder than running a migration command. In continuous-delivery systems around 2020, old and new application versions commonly overlapped during deployment. The expand-contract pattern manages compatibility through several controlled stages.

Architectural decisions and constraints

First add a compatible field or table while leaving the old read path operational. Next deploy code that writes the new shape and backfill existing data. Move reads only after verification, and remove obsolete fields last. This ordering preserves a rollback window for longer.

Database access flowConceptual sketch · summary of the article's technical flow
A four-stage architecture illustration prepared specifically for this article.

A practical scenario

Splitting a full-name field into separate first and last names illustrates the issue. Rewriting the entire table in one step may introduce unnecessary risk. New fields can be added, populated, and compared before changing API contracts. Temporary duplication costs storage but can reduce downtime.

Verification and implications

Success is not established merely because the SQL statement finished. Incorrect transformations, delayed workers, and older clients may still cause failures. Integrity counts, performance baselines, rollback plans, and post-release monitoring all belong to the migration task.

Define the data contract first

SQL changes need explicit keys, uniqueness rules, null semantics, time zones and transaction boundaries. Test retries and concurrent workers, not only a single successful request. Count source and destination records before migrations, retain checkpoints and keep a rollback path. Strong data contracts prevent duplicated or missing records when jobs are repeated.

Measure execution plans under representative load

An index is not a universal speed improvement. Inspect query plans, rows read, statistics freshness and write overhead together. A query made faster for one dashboard may slow down frequent ingestion. Compare latency percentiles and system resource use under realistic data distribution before calling the optimization successful.

Be the first reader ✎ Write a comment

Comments

No comments yet. Be the first to contribute.

What might reader discussion look like?Illustrative

These names, comments and editor replies are illustrative, not real visitor posts. Interactions are not saved. Use the real form below to contribute.

Charlie Adams

Reading “Sıfır kesintiye yakın veritabanı göçü: expand-contract yöntemi” raised this question for me: long-term maintenance cost is important.

Sample editor reply

Editor note: Security and failure modes require evidence beyond a launch post. We will revisit the assessment as the source is updated.

Alex Morgan

Features are only part of the story: security and privacy deserve their own review.

Robin Bennett

I would compare the announcement against independent benchmarks before making a decision.

✎ Write a comment

Your first and last name will appear publicly alongside your comment.