sql-migration-01core-12sqlDifficulty tier 4/5
Backfill a NOT NULL column on a large table without a long lock
postgresmigrationslockingbackfillddl
Task parameters
- Reference steps
- 10
- Step ceiling
- 45
- Runs
- 15
- Solved
- 14 of 15
- Models
- 5
What is broken, and what fixed means
A two file migration adds orders.status, derives it from four existing columns and makes it NOT NULL. It is already written, it applies, and every row ends up with the right value. It was rejected in review because it does all of that in three statements: one UPDATE over the whole table, which on the production table is twenty minutes of row locks and one snapshot held open for all of it, and a bare SET NOT NULL, which takes ACCESS EXCLUSIVE and then scans 180 million rows while holding it. Neither statement bounds how long it will wait for a lock. The task is to get the same column by a route that keeps every statement short: add it nullable, backfill in batches that commit, reach NOT NULL through a CHECK added NOT VALID and then validated, and set lock_timeout and statement_timeout before any of it. The workspace runs its own PostgreSQL 16 cluster with pg_stat_statements loaded, and the hidden suite reads per statement timings out of it rather than trusting the shape of the SQL.
Results by model
One group per model. The solve rate carries its spread across seeds, and every run below it links to the full step by step replay.
stub:hasty
66.7%+/- 47.1% over 3 seeds
3 runs, seeds 0, 1, 2
- seed 0solved 10/10 hidden testscompleteddockerreplay
- steps
- 7 of 45
- partial credit
- 100%
- step efficiency
- 1.000
- recovery
- n/a
- cost
- $0.00
- wall clock
- 18.5 s
- started
- 16 Sep 2026, 18:46 UTC
- seed 1not solved 6/10 hidden testscompleteddockerpremature finishF03replay
- steps
- 5 of 45
- partial credit
- 60%
- step efficiency
- n/a
- recovery
- n/a
- cost
- $0.00
- wall clock
- 12.7 s
- started
- 16 Sep 2026, 18:46 UTC
- seed 2solved 10/10 hidden testscompleteddockerreplay
- steps
- 8 of 45
- partial credit
- 100%
- step efficiency
- 1.000
- recovery
- n/a
- cost
- $0.00
- wall clock
- 18.6 s
- started
- 16 Sep 2026, 18:46 UTC
stub:methodical
100.0%+/- 0.0% over 3 seeds
3 runs, seeds 0, 1, 2
- seed 0solved 10/10 hidden testscompleteddockerreplay
- steps
- 10 of 45
- partial credit
- 100%
- step efficiency
- 1.000
- recovery
- n/a
- cost
- $0.00
- wall clock
- 27.4 s
- started
- 16 Sep 2026, 18:44 UTC
- seed 1solved 10/10 hidden testscompleteddockerreplay
- steps
- 10 of 45
- partial credit
- 100%
- step efficiency
- 1.000
- recovery
- n/a
- cost
- $0.00
- wall clock
- 26.7 s
- started
- 16 Sep 2026, 18:44 UTC
- seed 2solved 10/10 hidden testscompleteddockerreplay
- steps
- 10 of 45
- partial credit
- 100%
- step efficiency
- 1.000
- recovery
- n/a
- cost
- $0.00
- wall clock
- 27.5 s
- started
- 16 Sep 2026, 18:44 UTC
stub:reckless
100.0%+/- 0.0% over 3 seeds
3 runs, seeds 0, 1, 2
- seed 0solved 10/10 hidden testscompleteddockerF08F09replay
- steps
- 13 of 45
- partial credit
- 100%
- step efficiency
- 0.769
- recovery
- 100%
- cost
- $0.00
- wall clock
- 25.9 s
- started
- 16 Sep 2026, 18:52 UTC
- seed 1solved 10/10 hidden testscompleteddockerF08F09replay
- steps
- 13 of 45
- partial credit
- 100%
- step efficiency
- 0.769
- recovery
- 100%
- cost
- $0.00
- wall clock
- 26.3 s
- started
- 16 Sep 2026, 18:52 UTC
- seed 2solved 10/10 hidden testscompleteddockerF08F09replay
- steps
- 13 of 45
- partial credit
- 100%
- step efficiency
- 0.769
- recovery
- 100%
- cost
- $0.00
- wall clock
- 26.7 s
- started
- 16 Sep 2026, 18:52 UTC
stub:sloppy
100.0%+/- 0.0% over 3 seeds
3 runs, seeds 0, 1, 2
- seed 0solved 10/10 hidden testscompleteddockerF01F02F05replay
- steps
- 13 of 45
- partial credit
- 100%
- step efficiency
- 0.769
- recovery
- 100%
- cost
- $0.00
- wall clock
- 25.6 s
- started
- 16 Sep 2026, 18:50 UTC
- seed 1solved 10/10 hidden testscompleteddockerF01F02F05replay
- steps
- 13 of 45
- partial credit
- 100%
- step efficiency
- 0.769
- recovery
- 100%
- cost
- $0.00
- wall clock
- 25.5 s
- started
- 16 Sep 2026, 18:50 UTC
- seed 2solved 10/10 hidden testscompleteddockerF01F02F05replay
- steps
- 13 of 45
- partial credit
- 100%
- step efficiency
- 0.769
- recovery
- 100%
- cost
- $0.00
- wall clock
- 26.3 s
- started
- 16 Sep 2026, 18:50 UTC
stub:thrasher
100.0%+/- 0.0% over 3 seeds
3 runs, seeds 0, 1, 2
- seed 0solved 10/10 hidden testscompleteddockerF04replay
- steps
- 15 of 45
- partial credit
- 100%
- step efficiency
- 0.667
- recovery
- n/a
- cost
- $0.00
- wall clock
- 56.3 s
- started
- 16 Sep 2026, 18:47 UTC
- seed 1solved 10/10 hidden testscompleteddockerreplay
- steps
- 15 of 45
- partial credit
- 100%
- step efficiency
- 0.667
- recovery
- n/a
- cost
- $0.00
- wall clock
- 55.4 s
- started
- 16 Sep 2026, 18:47 UTC
- seed 2solved 10/10 hidden testscompleteddockerF04replay
- steps
- 15 of 45
- partial credit
- 100%
- step efficiency
- 0.667
- recovery
- n/a
- cost
- $0.00
- wall clock
- 35.6 s
- started
- 16 Sep 2026, 18:48 UTC