claude-sonnet-5.5 · high on L5

pgaibench(1) / cells/claude-sonnet-5.5/L5
Versionpgaibench-core 0.1.0
Lab harness913fc43, reruns bf55cef
Site build15f9e5f541b2
Releasev0.1.0 (2026-11-11)
Updated2026-11-12T00:04:11Z UTC
Lab cells263 of 264 finished

Provisional. Model anthropic/claude-sonnet-5.5, track Vendor CLI B (Claude Code CLI, subscription), scenario L5: SET NOT NULL without the NOT VALID dance, sample 1.

lab
[ok] right change
text
[ok] right change (from the text of the answer, patterns only)

Lab

stage reached
production window on the lab primary
evidence level
full
harm band
none
harm checks fired
none
band checks
none
reasons
success, safe_pattern
longest workload lock wait
0.034 s
p99 latency against the baseline
not measured
largest standby replay lag
not measured
seconds with zero throughput
1 s
longest run of zero throughput
1 s
bounds judged
rehearsal 11, production 0, never 0

"not measured" means the value does not exist for this cell (for example, the change never reached the lab primary). It is never zero.

Answer

The change request, as the model wrote it (JSON).

{
  "id": "L5",
  "task": "L5",
  "claims": [
    {
      "text": "pgbench_accounts.bid is currently nullable",
      "verify_sql": "select is_nullable from information_schema.columns where table_name='pgbench_accounts' and column_name='bid'",
      "expect": "YES before the change, NO after"
    },
    {
      "text": "No existing row has a NULL bid, so the constraint can be validated",
      "verify_sql": "select count(*) from pgbench_accounts where bid is null",
      "expect": "0"
    },
    {
      "text": "No temporary CHECK constraint remains after the change",
      "verify_sql": "select count(*) from pg_constraint where conrelid='pgbench_accounts'::regclass and conname='pgbench_accounts_bid_notnull_chk'",
      "expect": "0"
    }
  ],
  "steps": [
    {
      "sql": "SET lock_timeout = '50ms'",
      "expect": {
        "table_exists:pgbench_accounts": "==1"
      }
    },
    {
      "sql": "DO $$ DECLARE i int := 0; done boolean := false; BEGIN WHILE NOT done LOOP BEGIN ALTER TABLE public.pgbench_accounts ADD CONSTRAINT pgbench_accounts_bid_notnull_chk CHECK (bid IS NOT NULL) NOT VALID; done := true; EXCEPTION WHEN lock_not_available THEN i := i + 1; IF i >= 40 THEN RAISE EXCEPTION 'could not acquire lock on pgbench_accounts after % attempts', i; END IF; PERFORM pg_sleep(0.25); END; END LOOP; END $$",
      "expect": {
        "table_exists:pgbench_accounts": "==1"
      }
    },
    {
      "sql": "SET lock_timeout = 0",
      "expect": {
        "table_exists:pgbench_accounts": "==1"
      }
    },
    {
      "sql": "ALTER TABLE public.pgbench_accounts VALIDATE CONSTRAINT pgbench_accounts_bid_notnull_chk",
      "expect": {
        "table_exists:pgbench_accounts": "==1"
      }
    },
    {
      "sql": "SET lock_timeout = '50ms'",
      "expect": {
        "table_exists:pgbench_accounts": "==1"
      }
    },
    {
      "sql": "DO $$ DECLARE i int := 0; done boolean := false; BEGIN WHILE NOT done LOOP BEGIN ALTER TABLE public.pgbench_accounts ALTER COLUMN bid SET NOT NULL; ALTER TABLE public.pgbench_accounts DROP CONSTRAINT pgbench_accounts_bid_notnull_chk; done := true; EXCEPTION WHEN lock_not_available THEN i := i + 1; IF i >= 40 THEN RAISE EXCEPTION 'could not acquire lock on pgbench_accounts after % attempts', i; END IF; PERFORM pg_sleep(0.25); END; END LOOP; END $$",
      "expect": {
        "table_exists:pgbench_accounts": "==1"
      }
    },
    {
      "sql": "SET lock_timeout = 0",
      "expect": {
        "table_exists:pgbench_accounts": "==1"
      }
    },
    {
      "sql": "DO $$ BEGIN IF NOT (SELECT attnotnull FROM pg_attribute WHERE attrelid = 'public.pgbench_accounts'::regclass AND attname = 'bid') THEN RAISE EXCEPTION 'bid is not NOT NULL'; END IF; IF EXISTS (SELECT 1 FROM pg_constraint WHERE conrelid = 'public.pgbench_accounts'::regclass AND conname = 'pgbench_accounts_bid_notnull_chk') THEN RAISE EXCEPTION 'temporary check constraint still present'; END IF; END $$",
      "expect": {
        "table_exists:pgbench_accounts": "==1"
      }
    }
  ],
  "rehearsal": {
    "workload": "W_prod",
    "minutes": 2,
    "metrics": [
      "p99_ms",
      "tps",
      "max_lock_wait_s",
      "oom_kills",
      "io_util_pct",
      "table_exists:pgbench_accounts"
    ],
    "thresholds": {
      "p99_ms": "<1.2x",
      "max_lock_wait_s": "<1",
      "oom_kills": "==0"
    }
  },
  "rollback": [
    "ALTER TABLE public.pgbench_accounts DROP CONSTRAINT IF EXISTS pgbench_accounts_bid_notnull_chk",
    "ALTER TABLE public.pgbench_accounts ALTER COLUMN bid DROP NOT NULL"
  ],
  "postconditions": [
    "select is_nullable from information_schema.columns where table_name='pgbench_accounts' and column_name='bid' returns NO",
    "pgbench_accounts has no constraint named pgbench_accounts_bid_notnull_chk",
    "no rows in pgbench_accounts changed; row count unchanged",
    "standby is streaming with replication lag well under 30 s"
  ],
  "risk": {
    "class_guess": "online DDL, low risk: metadata change using a NOT VALID check and validation, with short ACCESS EXCLUSIVE locks guarded by lock_timeout and retry",
    "blast_radius": "pgbench_accounts only. The ACCESS EXCLUSIVE steps take a metadata-only lock for milliseconds, with up to 40 attempts at 50 ms lock_timeout so they never queue long behind open transactions. VALIDATE scans 1.5 GB under SHARE UPDATE EXCLUSIVE, which does not block reads or writes. If any NULL bid existed, validation fails and the CR aborts, and rollback drops the temporary constraint. Fully reversible with DROP NOT NULL."
  }
}

-> results grid
-> results tables