PGAIBench and AAA: can AI safely change production Postgres?
Modern engineering teams run far more Postgres clusters than human DBREs can watch by hand, leaving most databases underserved. Our goal is a new operating model where one experienced DBRE or SRE can reliably oversee 1,000 clusters, which requires safe, AI-driven database operations.
Frontier AI models already write valid SQL, and an agent with shell access can run it. The hard part of AI-driven database operations is knowing whether that SQL is safe to run on a live production database.
Ask any experienced database reliability engineer (DBRE) why they will not hand production Postgres to an AI agent, and the answer is rarely syntax. Databases are stateful, and real outages happen when valid SQL collides with real production state (often multi-terabyte) and live traffic. A schema change waits for a slow reporting query, and new queries on that table queue behind it. A config change pauses replica recovery, or an index that looks "unused" on the primary powers a critical query on a read replica.
To measure that gap, we built PGAIBench[1] v0.2 and tested frontier models on live two-node Postgres 18.7 clusters under concurrent load. Below, we also propose AAA (Analyst, Auditor, Actor), a clone-backed separation-of-duties architecture:
- Analyst proposes changes without production write access.
- Actor is a deterministic engine that rehearses every step on a live clone and applies only approved steps.
- Auditor is an independent model that reviews the clone evidence.
Four key learnings stand out:
- High capability does not prevent live outages. Acting alone,
claude-fable-5.2tied for the top score, yet still broke an implicit no-restart boundary in all 5 of 5 repeats on that task. Three runs broke live primaries, and the other two stopped in rehearsal only because its own post-change threshold tripped. - A deterministic clone gate stops mechanical failures at zero LLM cost, yet blind spots remain. Rehearsing on a two-node clone halted broken queries, lock stalls, and replication hangs automatically. Subtler errors still slipped past primary-only checks, such as
x-ai/grok-4.7dropping indexes that looked unused on the primary and crippling an async read replica. - Green clone summaries can both reassure and mislead AI reviewers. Real clone evidence cleared false alarms for most models, yet two failure modes persisted.
z-ai/glm-5.3saw a fast green test on a compact table and waved through a dangerousSET NOT NULLlock, whileclaude-haiku-5.5overreacted to noisy clone telemetry and blocked almost everything. - The good news: separating duties cuts live harm sharply. When we replayed the models' primary changes through AAA (retrospective and in-sample), the clone gate and Auditor together blocked 12 of 13 measured harms (-92.3%) while approving 377 of 378 safe or unclassified changes (99.7%).
Watch the podcast discussion: Can AI safely change production Postgres?[2]
Links
- [1] PGAIBench https://pgaibench.dev/
- [2] Can AI safely change production Postgres? https://www.youtube.com/watch?v=2ndlAxb32Fo





