Our two earlier MongoDB studies, EXP 013 and EXP 014, were careful, but they tested what PostgreSQL already does well. This study tests what MongoDB is built for. It takes four problems Odin has on record and asks, for each one, which database solves it correctly, with fewer operational components, at equal or better cost, when each gets its best realistic design.

There is no overall winner. Each of the four problems gets its own verdict: MongoDB fits, PostgreSQL fits, both fit, or neither. Before the plan was frozen, one reviewer argued for MongoDB's best design and one for PostgreSQL's, and either could veto a setup that would handicap its side. Both reviews are published below, in full.

Status: pre-registered; S2 is complete, and amendment 05 records how its run went (below). S1, S3 and S4 have not run. This plan was written, hashed and merged to main before any counted run. Counted runs start only after the commit that publishes it. Nothing in it may change afterwards, except by a dated amendment that is published first.

The four problems

They come from Odin's own decision records, listed in EXP 010's design study (section 1). Each one maps onto a native MongoDB mechanism, and none had been measured before this study. S2 has now been measured (amendment 05, below); S1, S3 and S4 have not.

The gate must pass before the primary metric counts. Data is synthetic, sized from Odin's recorded memory store (about 15,500 rows, 270 MB), and run at 1× and 10×.
ScenarioMongoDB armPostgreSQL armGatePrimary metric
S1. Records that keep their key order (hash-chained events, payload in a nested field)BSON decoded to dict; RawBSONDocument for a byte checkA json column with expression GIN / B-tree indexes on (payload::jsonb …); variant: a stored generated jsonb column100% of chains verify over the bytes the client reads back; nested queries (dot-notation / expression paths only) equal the oracleNested-query p95
S2. A change feed that survives a restartwatch() with $match; post-batch resume token persisted; startAfter; the driver's automatic resume(a) logical decoding with pgoutput, resuming from confirmed_flush_lsn; (b) a commit-order-safe outbox (an xid8 horizon). LISTEN/NOTIFY as a reference only0 lost and 0 duplicated effectsEnd-to-end lag p95, then components
S3. Expiry on append-only dataA TTL index, expireAfterSeconds: 0, on expireAtRange partitions on expires_at with DETACH CONCURRENTLY + DROP, or an owner-role batched DELETE; scheduled by pg_cron or a sidecarNo expired record visible past the grace; the application role never bypasses the append-only ruleComponents
S4. Aggregation over values inside documentsA pipeline with $match / $sort first, $group, $facet or separate concurrent pipelines, allowDiskUse explicitSQL over JSONB with GROUP BY / GROUPING SETS / FILTER, LATERAL jsonb_to_recordset, expression or generated columnsResults equal the oraclep95 at 10×

How a verdict is decided

Counting moving parts

A frozen checklist, and both counts are published. One component each for: every process or container beyond the database server; every extension not in core; every server setting changed off its default and needed for correctness; every persistent non-data object (a slot, publication, trigger, policy, partition scheme counted once per scheme, TTL index, custom role or keyFile); every scheduled job; and every safety alarm an operator must watch (an oplog window, slot retention). MongoDB pays for its replica set, keyFile, oplog sizing and oplog alarm. PostgreSQL pays for its slot, publication, wal_level, jobs and partitions.

An even setup

Predictions, written down so the result can contradict them

Frozen with the plan, from three parties.
WhoS1S2S3S4
The design author (corrected after the reviews)both-fit (the draft's "json loses indexing" was wrong)mongodb-fits, low-to-moderate confidencemongodb-fits on componentsboth-fit
The MongoDB advocateboth-fitmongodb-fits (moderate)mongodb-fitsboth-fit, leaning postgres-fits at 10×
The PostgreSQL advocateboth-fit, leaning postgres-fitsboth-fitmongodb-fits on components is plausibleboth-fit

The two reviews

Each reviewer was an independent model reviewer (Claude, fresh context), briefed to make sure its database got its best realistic design. Every veto was accepted. The PostgreSQL review caught a factual error in the draft ("json loses indexing" is false), an outbox that would drop late commits, and an append-only rule that favoured MongoDB. The MongoDB review pinned the decode type and payload placement for S1, tied the S3 grace to the configured TTL interval, and equalised retention for S2. Both asked for a primary metric, a margin and a definition of a component.

What this does not establish

Named as the next study, not judged here: failover with a 3-member replica set against Patroni (S5), sharding, multi-region, and search / vector search. Failover is MongoDB's home ground, so it is named explicitly; on one shared Docker host a fair PostgreSQL arm for it (streaming replication with Patroni and etcd) is a memory and stability risk to both arms. The run does not imply anything about any of them. EXP 013 and EXP 014 stand as published; this experiment does not change or replace them.

Amendment 01: changes to S2's runner, published late

This plan says a change is a dated amendment, published first. For S2, the change-feed scenario, that did not happen. Its runner was changed four times, and given a rule for which counted cells count, after this plan was published and after S2's first two counted cells ran. Those two cells ran on the old code and were discarded; every kept cell ran under the changes. Amendment 01 (also on this site) publishes all of it before S2's report, and we own the gap.

The S2 runner's protocol is published too. The amendment also records that the protocol pairs MongoDB with the better PostgreSQL variant per repetition, while this plan says "the other store's best variant"; amendment 01 left that open. S1, S3 and S4 are not affected.

Amendment 02: one PostgreSQL variant per scale

Amendment 02 (also on this site) settles the pairing before S2's verdict is computed. For each scale, PostgreSQL is represented by one variant, chosen once: among the variants that pass the gate in every counted cell at that scale on both seeds, the one with the lowest median of its seed-1 lag p95s. That variant is compared with MongoDB in every pair. Picking the better variant in each repetition would be a best-of-two that favours PostgreSQL; it is still published, labelled as a secondary analysis, and never decides the verdict.

In the amendment's own words: the decision was made on 25 October 2026, before S2's verdict was computed, by the R&D orchestrator, not by either advocate. Interim seed-1 results had already been seen, so it is not blind. We chose the rule the advocates of both sides had already agreed was fair for EXP 021, rather than one picked with the data in view. Both of this experiment's advocates were asked to review that decision, with veto power, before the verdict.

Amendment 03: the advocates' answer

Both advocates reviewed the rule and the paragraph before S2's verdict was computed, without opening S2's result files. Amendment 03 (also on this site) records their answer and both reviews (MongoDB advocate, PostgreSQL advocate).

Amendment 04: nine readings of the S2 rules, settled before the verdict

Writing S2's report code showed nine places where the published rules leave a reading open. The runner's owner did not decide them alone: both advocates reviewed all nine before S2's verdict was computed, with veto power, without opening a counted cell. Amendment 04 (also on this site) records their answer and both reviews (MongoDB advocate, PostgreSQL advocate). It is not the S2 runner protocol's own "Amendment 04", which is a different change.

S2's verdict is computed only after this amendment is published and all 60 counted cells exist.

Amendment 05: S2's run record

S2 is complete: all 60 counted cells exist, and the report was computed under the rules above. Amendment 05 (also on this site) records how the run got there. The plan was held for 13 days and 6 hours by a stale pause flag, then resumed and re-measured exactly the missing cells. A helper script stopped the stack once, and no counted cell was affected. All 13 discarded cells are listed with their causes; two of them were refused by the report's own overlap check. The record gives the sha256 of the report, the files it read and every counted cell. It quotes the report's verdict without recomputing it: PostgreSQL fits at both scales, with pgoutput as the chosen variant, and against the outbox variant alone MongoDB fits (secondary, never deciding). The report and its cells are private and cited by hash. The amendment changes no rule.

Provenance

The pre-registration (also published on this site, byte for byte) is a faithful port of a frozen design: two-advocate review, source commit bb364127 in a private repository; PREREG sha256 83f35a8c…. It carries the frozen text in full. Machine names and internal ids were replaced with neutral wording in four places, each listed in the record; nothing else in the text differs. The two reviews and the freeze notes are published byte for byte.

Pre-registered experiment; S2 complete, amended five times. Two databases, one host plus a second-OS replication, synthetic data sized from one recorded store, no failover or scale-out.