Skip to content
Solutions · Developer tools

Schema changes on large tables.

The flagship wedge, felt first by teams whose users notice p99 immediately.

Measure the strongest lock held per table, how long it was held, whether another session was left waiting on it, and how the query plans moved.

Start with Postgres volume, plans, and pools, then expand.

EXPLAIN ANALYZE · events
12,403,881 rows
Baseline
Limit
12.00ms
cost=0.43..8.43
Index Scan
pass
events_created_at_idx
12ms
cost=0.43..8.42rows=1 width=128
Candidate
Limit
410.12ms
cost=0.00..184102
Seq Scan
block
events
410ms
cost=0.00..184102.00rows=12.4M width=128

lock ACCESS EXCLUSIVE · 4.2s · another session waiting

Users notice p99 immediately

Large tables plus frequent schema change.

  • Large tables. Exclusive locks and rewrites that never show up on a laptop database.

  • Query plans. Plan regressions under production-shaped volume.

  • Pools. Connection-pool exhaustion during migrate-and-serve.

Lock wait graph
ACCESS EXCLUSIVE
  1. pid 1842
    ALTER subscriptions
    ACCESS EXCLUSIVEholds 27.4s
  2. pid 2210
    SELECT events
    ACCESS SHAREwaiting · p99 6.9s
  3. pool
    migrate-and-serve
    pool waitconnections queued

27.4s hold · events p99 820ms → 6.9s

Narrow adapters, complete stack

Exceptional Postgres instrumentation first.

  • The first supported stack should be exceptional. A broad compatibility list with unreliable connectors would destroy trust.

  • Postgres first. Volume, plans, and pools, then expand.

  • Publish what the twin reproduced. Do not pretend unsupported components are cloned.

Schema coexistence
expand · backfill · contract
  1. 01
    Expand
    col
    access_tier
    null
    yes
    default
    none
  2. 02
    Backfill
    batch
    12k / pass
    dual-read
    on
    pool
    live
  3. 03
    Contract
    constraint
    last
    old path
    kept
    safe
    not yet
Postgres first

Publish what the twin reproduced. Do not pretend unsupported components are cloned.

The wedge

Locks, plans, and rollback feasibility before it ships.

  • Lock duration. The strongest mode held per table, how long it was held, and whether another session waited on it.

  • Schema coexistence. Whether old instances can still read the new schema shows up here first.

  • Users notice p99 immediately. Large tables plus frequent schema change.

subscriptions · lock hold
ACCESS EXCLUSIVE
peak hold
27.4s
ExclSharep99
27.4s
0s16s32s
peak hold
27.4s
events p99
820ms → 6.9s
waiter
waiting

Another session was left waiting. events p99 moved 820ms → 6.9s.

Next

Know what happens before you deploy.

Create a disposable production twin for every risky change. Catch migration failures before they reach customers.