trajectory
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
25
Solved
14 of 25
Agents
10

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.

How strong the hidden tests are

Mutation testing: the reference replayed with one small change in a file it writes, the slip a model makes, and the hidden tests run on the result. A change the tests pass is a near miss this reward would pay in full.

Near misses caught
8 of 12
By an assertion
8
Got through
4
Mutation sites
24

Changes the hidden tests did not reliably notice

  • migrations/0002_add_status.up.sql:30 < -> <=
  • migrations/0002_add_status.up.sql:24 10000 -> 10001
  • migrations/0002_add_status.up.sql:35 > -> >=
  • migrations/0002_add_status.up.sql:35 0 -> 1

Some of these may be equivalent to the original, so no test could notice them. The rest are near misses this reward would pay in full.

Results by agent

One group per agent, a scripted policy that checks the harness or a real model. The solve rate carries its spread across seeds, and every run below it links to the full step by step replay.

nvidia_nim/minimaxai/minimax-m3.1-flash

0.0%+/- 0.0% over 2 seeds

2 runs, seeds 0, 1

nvidia_nim/nvidia/nemotron-3-ultra-550b-a55b

0.0%+/- 0.0% over 2 seeds

2 runs, seeds 0, 1

nvidia_nim/nvidia/nemotron-3.5-lightning-30b-a3b

0.0%+/- 0.0% over 2 seeds

2 runs, seeds 0, 1

nvidia_nim/openai/gpt-oss-20b

0.0%+/- 0.0% over 2 seeds

2 runs, seeds 0, 1

nvidia_nim/z-ai/glm-5.3

0.0%+/- 0.0% over 2 seeds

2 runs, seeds 0, 1

stub:hasty

66.7%+/- 47.1% over 3 seeds

3 runs, seeds 0, 1, 2

stub:methodical

100.0%+/- 0.0% over 3 seeds

3 runs, seeds 0, 1, 2

stub:reckless

100.0%+/- 0.0% over 3 seeds

3 runs, seeds 0, 1, 2

stub:sloppy

100.0%+/- 0.0% over 3 seeds

3 runs, seeds 0, 1, 2

stub:thrasher

100.0%+/- 0.0% over 3 seeds

3 runs, seeds 0, 1, 2