kimi-k3.1-pro · high on L7pgaibench(1) / cells/kimi-k3.1-pro/L7 | Version | pgaibench-core 0.1.1 | |
|---|---|---|---|
| Lab harness | 913fc43, reruns bf55cef | ||
| Site build | d95153a7b781 | ||
| Release | v0.1.7 (2026-11-17) | ||
| Updated | 2026-11-17T23:37:00Z UTC | ||
| Lab cells | 285 of 286 finished | ||
- 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.014 s
- p99 latency against the baseline
- not measured
- largest standby replay lag
- not measured
- seconds with zero throughput
- 0 s
- longest run of zero throughput
- 0 s
- workload query errors after the change
- 0
- seconds from first to last workload error
- not measured
- bounds judged
- rehearsal 13, 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": "L7",
"task": "L7",
"claims": [
{
"text": "The orders table has no archived column before the change.",
"verify_sql": "select count(*) from information_schema.columns where table_schema = 'public' and table_name = 'orders' and column_name = 'archived'",
"expect": "0"
},
{
"text": "The baseline contains 835616 orders created before 2026-01-01 that require archival marking.",
"verify_sql": "select count(*) from public.orders where created_at < timestamptz '2026-01-01 00:00:00+00'",
"expect": "835616"
},
{
"text": "A valid primary-key index on orders.id supports bounded, indexed backfill batches.",
"verify_sql": "select i.indisvalid and i.indisready from pg_class t join pg_index i on i.indrelid = t.oid where t.oid = 'public.orders'::regclass and i.indisprimary",
"expect": "true"
},
{
"text": "After the change, archived is boolean, NOT NULL, and has the constant default false.",
"verify_sql": "select a.atttypid = 'boolean'::regtype and a.attnotnull and pg_get_expr(d.adbin, d.adrelid) = 'false' from pg_attribute a join pg_attrdef d on d.adrelid = a.attrelid and d.adnum = a.attnum where a.attrelid = 'public.orders'::regclass and a.attname = 'archived' and not a.attisdropped",
"expect": "true"
}
],
"steps": [
{
"sql": "SET lock_timeout = '300ms'; ALTER TABLE public.orders ADD COLUMN archived boolean NOT NULL DEFAULT false; RESET lock_timeout;",
"retries": 10,
"expect": {
"max_lock_wait_s": "<1",
"oom_kills": "==0",
"table_exists:orders": "==1"
}
},
{
"sql": "DO $do$\nDECLARE\n v_min bigint;\n v_max bigint;\n v_lo bigint;\n v_hi bigint;\n v_rows bigint;\n v_total bigint := 0;\n v_pass integer;\nBEGIN\n FOR v_pass IN 1..5 LOOP\n SELECT min(o.id), max(o.id)\n INTO v_min, v_max\n FROM public.orders AS o\n WHERE o.created_at < timestamptz '2026-01-01 00:00:00+00'\n AND NOT o.archived;\n\n EXIT WHEN v_min IS NULL;\n v_lo := v_min;\n\n WHILE v_lo <= v_max LOOP\n v_hi := v_lo + 2000;\n\n WITH picked AS MATERIALIZED (\n SELECT o.id\n FROM public.orders AS o\n WHERE o.id >= v_lo\n AND o.id < v_hi\n AND o.created_at < timestamptz '2026-01-01 00:00:00+00'\n AND NOT o.archived\n ORDER BY o.id\n FOR NO KEY UPDATE SKIP LOCKED\n )\n UPDATE public.orders AS o\n SET archived = true\n FROM picked\n WHERE o.id = picked.id;\n\n GET DIAGNOSTICS v_rows = ROW_COUNT;\n v_total := v_total + v_rows;\n COMMIT;\n v_lo := v_hi;\n PERFORM pg_sleep(0.005);\n END LOOP;\n END LOOP;\n\n IF EXISTS (\n SELECT 1\n FROM public.orders AS o\n WHERE o.created_at < timestamptz '2026-01-01 00:00:00+00'\n AND NOT o.archived\n ) THEN\n RAISE EXCEPTION 'orders archival backfill incomplete after repeated SKIP LOCKED passes';\n END IF;\n\n RAISE NOTICE 'orders archival backfill updated % rows', v_total;\nEND\n$do$;",
"expected_rows": 0,
"expect": {
"max_lock_wait_s": "<1",
"oom_kills": "==0",
"table_exists:orders": "==1"
}
},
{
"sql": "DO $do$\nBEGIN\n IF NOT EXISTS (\n SELECT 1\n FROM pg_attribute AS a\n JOIN pg_attrdef AS d\n ON d.adrelid = a.attrelid\n AND d.adnum = a.attnum\n WHERE a.attrelid = 'public.orders'::regclass\n AND a.attname = 'archived'\n AND NOT a.attisdropped\n AND a.atttypid = 'boolean'::regtype\n AND a.attnotnull\n AND pg_get_expr(d.adbin, d.adrelid) = 'false'\n ) THEN\n RAISE EXCEPTION 'orders.archived does not have the required boolean NOT NULL DEFAULT false definition';\n END IF;\n\n IF EXISTS (\n SELECT 1\n FROM public.orders AS o\n WHERE o.created_at < timestamptz '2026-01-01 00:00:00+00'\n AND o.archived IS DISTINCT FROM true\n ) THEN\n RAISE EXCEPTION 'at least one pre-2026 order is not archived';\n END IF;\nEND\n$do$;",
"expected_rows": 0,
"expect": {
"max_lock_wait_s": "<1",
"oom_kills": "==0",
"table_exists:orders": "==1"
}
}
],
"rehearsal": {
"workload": "W_prod",
"minutes": 2,
"metrics": [
"p99_ms",
"p99_rel",
"tps",
"max_lock_wait_s",
"io_util_pct",
"oom_kills",
"dead_tuples:orders",
"checkpoints_req_share"
],
"thresholds": {
"p99_rel": "<1.2x",
"max_lock_wait_s": "<1",
"io_util_pct": "<90",
"oom_kills": "==0"
}
},
"rollback": [
"ALTER TABLE public.orders DROP COLUMN IF EXISTS archived;"
],
"postconditions": [
"public.orders.archived exists as boolean NOT NULL with constant default false.",
"No order with created_at before 2026-01-01 remains with archived distinct from true.",
"Orders created after the cutoff retain the default archived = false unless explicitly changed by an application.",
"No other table's rows are modified, and replication, WAL archiving, autovacuum, pg_stat_statements, and track_io_timing remain enabled."
],
"risk": {
"class_guess": "medium",
"blast_radius": "The DDL briefly requires ACCESS EXCLUSIVE on orders; a 300 ms lock timeout and retries prevent a long lock queue. The backfill updates approximately 835616 allowed orders rows, generating dead tuples, extra table storage, WAL, and standby replay work. It uses committed 2000-id indexed ranges, short transactions, throttling, ascending lock order, and SKIP LOCKED cleanup passes to bound blocking and replication impact. An abort after partial backfill is undone by dropping the new column, which removes both its definition and all archived values; after successful completion, the archival markings are intentionally persistent."
}
}