● Live Database Benchmark · MongoDB 8.3.4 vs Postgres 16.14

How many tokens does an AI agent spend
building on MongoDB vs Postgres?
We measured. No hypotheses. No claims. Just data.

The world's most realistic benchmark for database AI-friendliness. A 100-entity enterprise schema across 10 domains. 100 files, ~10K LOC. SWE-bench F2P+P2P verification. Real CLI agents. Live databases. No claims, no hypotheses, no verdicts. Just raw data from real agents on real databases.

100
Entities in schema
30/30
Cells passed clean
2
Independent AI agents
100%
Live DB verification
The Result

The raw numbers. No claims.

We asked two independent AI coding agents (Codex gpt-5.6-terra and Claude Sonnet) to add a field to an existing codebase with a 100-entity schema (4,000+ lines of inline schema code) across 100 files (~10K LOC). SWE-bench F2P+P2P verification: all new tests must pass AND no existing tests may break. Each agent was compared only to itself — never cross-CLI.

Median tokens read across 5 clean repeats per cell. Lower is better.

No hypotheses. No verdicts. Just the raw numbers — you decide what they mean.

Why do Claude Code and Codex show different token counts for the same task?

Each CLI counts tokens differently. Claude Code includes the system prompt, tool definitions, and cache read/creation in every token count — so its numbers are inherently higher. Codex counts usage events differently. These numbers are never compared cross-agent. Each agent is compared only to itself across the three database lanes. The percentage differences (e.g. +177%) are within-agent — they measure how much MORE the same agent spends on Postgres vs MongoDB, not how one agent compares to the other.

Zero Bias · 100% Legit

How we proved it's not rigged

Every benchmark claims to be fair. This one proves it with 10 independent defenses — any one of which would catch bias if it existed.

The Pipeline

How a benchmark cell runs — step by step

No mocks. No simulated agents. No estimated tokens. Every number comes from a real AI agent writing real code against a real database. vanilla mode, anti-cheat, within-agent comparison — zero bias.

The Money

What this costs at enterprise scale

If your team runs 1,000 AI database-tasks per month, here's the monthly token bill per database design — based on the measured medians. MongoDB saves significant money on every agent.

Assumptions: 1,000 tasks/month. Token cost estimated at $3/M input tokens (Claude) and $2/M input tokens (Codex). within-agent comparison only — absolute costs are not cross-comparable between agents because CLIs count tokens differently. vanilla mode: no skills, no code reviews, no subagents. anti-cheat: source-pattern scan, protected files, cheat-signal detection.

The Schema

A real enterprise schema — 100 entities across 10 domains, 4,000+ lines of inline schema code, 100 files, ~10K LOC.

Based on research into real enterprise database complexity (SAP, Salesforce, Workday, GitLab). 100 entities across 10 business domains, written as inline schema code the agent must read. MongoDB stores them as 55 collections with embedded arrays. Postgres stores them as 100 normalized tables with foreign keys and CHECK constraints.

The Task

A real enterprise day-to-day change request

The agent receives a change ticket — exactly what a developer gets in an enterprise. It must understand the existing schema, find where the field goes, write the migration, update the query, and not break anything.

Change Request: Add preferredPaymentMethod to accounts

"Add a preferredPaymentMethod field (string, optional, enum: credit_card / wire_transfer / ach / paypal) to the accounts entity. Update the getOrderSummary query to include the account's preferredPaymentMethod in the result."

  1. Read src/schema.mjs (4,000+ lines of inline schema) to understand the 100-entity schema
  2. Read src/accounts.mjs, src/orders.mjs, src/invoices.mjs, src/products.mjs, src/support.mjs — 27 model files with working CRUD code
  3. Read src/queries.mjs for the order summary query
  4. Update the schema to add the new field to the accounts entity
  5. Update the account model to handle preferredPaymentMethod in create/update
  6. Update getOrderSummary to include preferredPaymentMethod in the result
  7. Run npm test until it passes — tests check regression AND new behavior
  8. Tests query the LIVE database directly — no mocks, no fakes
✓ Regression tested ✓ Live DB verified ✓ Schema evolution + query update Protected files: db.mjs, tests/