gemini-3.8-flash · default on L7

pgaibench(1) / cells/gemini-3.8-flash/L7
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 google/gemini-3.8-flash, track Router (OpenRouter, pinned provider), scenario L7: Whole migration in one transaction: DDL + backfill holds AEL, 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 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
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": "CR-L7-add-archived-column",
  "task": "L7",
  "claims": [
    {
      "text": "orders table currently lacks the archived column",
      "verify_sql": "SELECT count(*) FROM information_schema.columns WHERE table_name = 'orders' AND column_name = 'archived';",
      "expect": "0"
    },
    {
      "text": "orders created before 2026-01-01 count matches baseline",
      "verify_sql": "SELECT count(*) FROM orders WHERE created_at < '2026-01-01';",
      "expect": "835616"
    }
  ],
  "steps": [
    {
      "sql": "SET lock_timeout = '1s';",
      "expect": {
        "table_exists:orders": "==1"
      }
    },
    {
      "sql": "ALTER TABLE orders ADD COLUMN archived boolean NOT NULL DEFAULT false;",
      "retries": 5,
      "expect": {
        "table_exists:orders": "==1"
      }
    },
    {
      "sql": "SET lock_timeout = '4s';",
      "expect": {
        "table_exists:orders": "==1"
      }
    },
    {
      "sql": "CREATE TEMP TABLE orders_to_archive AS SELECT id, row_number() OVER () AS rn FROM orders WHERE created_at < '2026-01-01';",
      "expect": {
        "table_exists:orders": "==1"
      }
    },
    {
      "sql": "CREATE INDEX idx_orders_to_archive_rn ON orders_to_archive (rn);",
      "expect": {
        "table_exists:orders": "==1"
      }
    },
    {
      "sql": "DO $$\nDECLARE\n  v_batch_size INT := 5000;\n  v_cur INT := 1;\n  v_max INT;\nBEGIN\n  SELECT coalesce(max(rn), 0) INTO v_max FROM orders_to_archive;\n  WHILE v_cur <= v_max LOOP\n    UPDATE orders o\n    SET archived = true\n    FROM orders_to_archive t\n    WHERE t.rn >= v_cur AND t.rn < v_cur + v_batch_size\n      AND o.id = t.id;\n    COMMIT;\n    v_cur := v_cur + v_batch_size;\n  END LOOP;\nEND $$;",
      "expect": {
        "table_exists:orders": "==1"
      }
    },
    {
      "sql": "DROP TABLE orders_to_archive;",
      "expect": {
        "table_exists:orders": "==1"
      }
    },
    {
      "sql": "DO $$ \nDECLARE\n  v_remaining INT;\nBEGIN\n  SELECT count(*) INTO v_remaining FROM orders WHERE created_at < '2026-01-01' AND NOT archived;\n  IF v_remaining > 0 THEN\n    RAISE EXCEPTION 'Remaining unarchived orders: %', v_remaining;\n  END IF;\nEND $$;",
      "expect": {
        "table_exists:orders": "==1"
      }
    },
    {
      "sql": "ANALYZE orders;",
      "expect": {
        "table_exists:orders": "==1"
      }
    }
  ],
  "rehearsal": {
    "workload": "W_prod",
    "minutes": 2,
    "metrics": [
      "p99_rel",
      "max_lock_wait_s"
    ],
    "thresholds": {
      "p99_rel": "<1.2x",
      "max_lock_wait_s": "<5"
    }
  },
  "rollback": [
    "ALTER TABLE orders DROP COLUMN IF EXISTS archived;"
  ],
  "postconditions": [
    "SELECT count(*) FROM information_schema.columns WHERE table_name = 'orders' AND column_name = 'archived' AND data_type = 'boolean' AND is_nullable = 'NO' AND column_default = 'false'",
    "SELECT count(*) FROM orders WHERE created_at < '2026-01-01' AND NOT archived"
  ],
  "risk": {
    "class_guess": "online DDL with batched backfill",
    "blast_radius": "orders table schema and archived flag for pre-2026 orders"
  }
}

-> results grid
-> results tables