Postgres Migration Rehearsal
Submit a migration before release to see its lock-conflict timeline, risky statements, and a rollback-ready execution order.
Before a startup runs a PostgreSQL migration, it uploads the SQL, the current schema, and anonymized statistics for row counts, indexes, and access volume. The product never touches the production database. Instead, it replays the migration in a temporary replica and simulates concurrent reads and writes, lock waits, and rollback paths after failures.
The results page uses a lock-wait timeline to show which statements can block writes, which tables will slow down, and how different execution orders change the outcome. Teams can open a risky statement to see why it locks a table, which endpoints may be affected, and whether it should be split into steps such as adding a field, backfilling in the background, switching reads, and deleting later.
Once a team chooses an approach, the system generates ordered run cards. Each card specifies the command to run, the metrics to check beforehand, how long to observe, and the conditions that require a stop or rollback. The on-call engineer can log the actual duration on each card for the next migration.
The first version focuses on common DDL migrations and lock risks. It does not deploy changes automatically or replace backup and recovery drills. Its purpose is to turn a migration that “should be fine” into a rehearsal with visible risk and a retreat path before release.
Why now
On July 22, this guide reached Hacker News and ranked sixth as of July 23. S1 It can focus schema-change teams on the risk of blocking writes, while also revealing that static advice cannot see wait chains or the order of retreat. S2
Target user
The core users are startup backend leads, platform engineers, and that week’s on-call engineer at teams without a dedicated DBA. The trigger is a finished migration and a scheduled release, with no one able to tell how long locks might queue. There is still time to change the script, while the cost of deploying blindly is already high. On-call staff need more than a risk label: they need an executable sequence and a way to retreat.
Minimal entry point
The entry point accepts migration SQL, the current schema, and anonymized table-level statistics. The service recreates the structure in an isolated PostgreSQL instance and generates placeholder data from row counts. It uses custom pgbench scripts to create concurrent reads and writes, then captures wait relationships from pg_locks and pg_stat_activity. S2 Initial scope is limited to common ALTER TABLE, index, and constraint changes. Results first show lock modes, blocking chains, durations, and failure points; they do not estimate actual endpoint latency. Deterministic rules turn the plan into expand, backfill, switch, and contract steps. Non-transactional operations are flagged separately, and users must provide a verifiable rollback action.
Punching above its weight
Start as a GitHub App that posts a static lock summary and one-click rehearsal link to migration PRs. The free tier runs small isolated instances and publishes a library of common DDL risk cases. Developers can write short retrospectives around real migrations, with importable rehearsal templates. Support common migration directory layouts to minimize changes to existing workflows.
Competitors & gaps
- SquawkGoogle
- Squawk already uses static linting to identify risky migrations and recommends setting lock_timeout and statement_timeout. S3 It is well suited to catching known anti-patterns in code review and can suggest specific rewrites. Its documentation explicitly warns that passing lint does not mean a migration is safe to run. S3 That leaves room for a rehearsal in a temporary database that actually runs the script under concurrent reads and writes. Rather than just listing rules, the output could show who is waiting on whom and for how long. With table-level row counts and traffic data, it could also compare decomposition strategies and execution orders. The deliverable goes further, into on-call run cards, stop conditions, and rollback steps. The trade-off is slower analysis and conclusions that depend more heavily on how closely the inputs resemble production.
- BytebaseGoogle
- Bytebase already covers SQL review, staged rollouts, approvals, audit trails, and drift detection. S4 It is closer to a full database CI/CD control plane, suited to teams that need centralized governance. Its public materials emphasize rule checks, environment promotion, and process records. S4 They do not show a lock-wait timeline built by creating a temporary replica from uploaded statistics and replaying concurrent load. Nor does it break a single migration into stop cards for an on-call engineer to execute one by one. The opportunity is a narrow tool that never touches production and serves small teams without a DBA first. It need not replace existing migration tooling; it adds a rehearsal before merge and before release. If Bytebase adds deep simulation, an independent product’s workflow advantage would shrink substantially.
How it makes money
Team subscriptions tiered by monthly rehearsal volume. Static checks are free; hosted concurrent rehearsals, runbooks, and history are paid.
The case against
The greatest risk is not that the rehearsal fails to run, but that it looks too much like the truth. Table-level row counts and traffic cannot reproduce query shapes, hot keys, long-running transactions, hardware differences, or background jobs. A rehearsal may miss production blocking or overstate the danger of harmless operations. Treating its output as a deployment guarantee would create false confidence. Many DDL changes cannot be undone by simply running reverse SQL, and data backfills and application-version cutovers introduce business-compatibility concerns. Teams must also contend with schema-exposure concerns, plus the wait time and compute cost of creating temporary databases. For teams that already have high-fidelity staging, an experienced DBA, and migration runbooks, the tool may simply duplicate existing process.