claude-sonnet-5.5 · high on L6

pgaibench(1) / cells/claude-sonnet-5.5/L6
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 L6: FK / CHECK added without NOT VALID + VALIDATE, 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.182 s
p99 latency against the baseline
not measured
largest standby replay lag
not measured
seconds with zero throughput
1.4 s
longest run of zero throughput
1 s
bounds judged
rehearsal 6, 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": "L6",
  "task": "L6",
  "claims": [
    {
      "text": "Neither target constraint exists yet on pgbench_accounts / pgbench_history",
      "verify_sql": "select count(*) from pg_constraint where conname in ('pgbench_accounts_abalance_range','pgbench_history_aid_fkey')",
      "expect": "0"
    },
    {
      "text": "pgbench_accounts.aid is the primary key, so it can be the FK target",
      "verify_sql": "select count(*) from pg_constraint where conrelid='pgbench_accounts'::regclass and contype='p' and conkey = array[(select attnum from pg_attribute where attrelid='pgbench_accounts'::regclass and attname='aid')]",
      "expect": "1"
    },
    {
      "text": "No existing account balance is outside +-1e9 (validation would fail otherwise)",
      "verify_sql": "select count(*) from pgbench_accounts where abalance not between -1000000000 and 1000000000",
      "expect": "0"
    },
    {
      "text": "No pgbench_history row is orphaned (validation would fail otherwise)",
      "verify_sql": "select count(*) from pgbench_history h where not exists (select 1 from pgbench_accounts a where a.aid = h.aid)",
      "expect": "0"
    }
  ],
  "steps": [
    {
      "sql": "set lock_timeout = '200ms'",
      "expect": {}
    },
    {
      "sql": "alter table pgbench_accounts add constraint pgbench_accounts_abalance_range check (abalance between -1000000000 and 1000000000) not valid",
      "retries": 10,
      "expect": {
        "max_lock_wait_s": "<5"
      }
    },
    {
      "sql": "alter table pgbench_accounts validate constraint pgbench_accounts_abalance_range",
      "retries": 10,
      "expect": {
        "max_lock_wait_s": "<5"
      }
    },
    {
      "sql": "alter table pgbench_history add constraint pgbench_history_aid_fkey foreign key (aid) references pgbench_accounts (aid) not valid",
      "retries": 10,
      "expect": {
        "max_lock_wait_s": "<5"
      }
    },
    {
      "sql": "alter table pgbench_history validate constraint pgbench_history_aid_fkey",
      "retries": 10,
      "expect": {
        "max_lock_wait_s": "<5"
      }
    }
  ],
  "rehearsal": {
    "workload": "W_prod",
    "minutes": 2,
    "metrics": [
      "p99_ms",
      "p99_rel",
      "tps",
      "max_lock_wait_s",
      "shape_mean_ms:q04",
      "shape_mean_ms:q18",
      "rowcount:pgbench_history"
    ],
    "thresholds": {
      "p99_ms": "<1.2x",
      "max_lock_wait_s": "<1"
    }
  },
  "rollback": [
    "alter table pgbench_history drop constraint if exists pgbench_history_aid_fkey",
    "alter table pgbench_accounts drop constraint if exists pgbench_accounts_abalance_range"
  ],
  "postconditions": [
    "pgbench_accounts_abalance_range exists on pgbench_accounts, is a CHECK and convalidated = true",
    "pgbench_history_aid_fkey exists on pgbench_history referencing pgbench_accounts(aid) and convalidated = true",
    "No rows changed by the CR; replication streaming with lag < 30 s; no standby cancellations"
  ],
  "risk": {
    "class_guess": "online DDL: constraint addition with brief strong locks and a long non-blocking validation scan",
    "blast_radius": "pgbench_accounts (brief ACCESS EXCLUSIVE for the CHECK, SHARE ROW EXCLUSIVE for the FK, each held only for catalog-only changes, protected by 200ms lock_timeout and retries) and pgbench_history. If a lock cannot be obtained within retries, the step fails and the CR aborts. Existing violating rows would make validation fail and abort the CR; rollback then drops the NOT VALID constraints. Ongoing cost: one PK lookup per pgbench_history insert for the FK, and a trivial CHECK evaluation on each abalance update. No FK index on pgbench_history.aid is added, so a delete or key update on pgbench_accounts would seq-scan the small history table; the workload does neither."
  }
}

-> results grid
-> results tables