Postgres was rewritten in Rust and somehow passed every test

pgrust: What Changed in the Thirteen Days After This Video

A Rust reimplementation of Postgres passing all 46,066 official regression queries is a real and verifiable achievement. But the video's central caveat — that the interesting version is unpublished and unbenchmarkable — expired within two weeks. The released code revises the performance claims downward, and buries a finding more interesting than any speed number.

Video thumbnail
📺 Better Stack ⏱️ 8:34 📅 17 July 2026 👁️ 44,857 views
pgrust PostgreSQL Rust AI-assisted rewrites Formal verification Benchmarks

🦀 The claim, and the test 0:00

The opening does something most tool coverage does not: it states the headline and immediately withdraws the obvious conclusion.

"Someone rebuilt Postgres in Rust, and somehow the release version now passes all 46,000 Postgres regression queries. It works with normal psql. It can even boot an existing Postgres 18.3 data directory. That sounds like a production-ready replacement. It isn't."

The diagnosis of why anyone would attempt this is fair. Postgres carries nearly four decades of architecture and roughly a million lines of C. Every client connection gets its own backend process — isolation that is genuinely useful, and that also means memory overhead per connection, pressure toward external pooling, and difficulty sharing state across parallel work.

pgrust's premise is narrow and unusual: keep the behaviour, keep the client experience, keep the on-disk formats, replace the engine. Not a fork, not an extension — an independent implementation that treats real Postgres as the specification.

The repository is real and I checked it directly. malisper/pgrust3,912 stars, 147 forks, Rust, AGPL-3.0, created 20 April 2026 and pushed to the day I wrote this. The README's own badges claim 46,066/46,066 regression tests and Postgres 18.3 compatibility.

✅ What 46,066 tests prove 2:45

The demo is straightforward and the presenter does not oversell it: official Docker image, an ordinary psql client, create a table, insert data, run EXPLAIN. The planner chooses an index scan and returns real execution statistics. From the outside it is indistinguishable from Postgres.

His summary of what that establishes is the correct one:

Passing the suite proves this is a real database server, not a partial implementation. It speaks the actual wire protocol, has a working query planner and storage engine, and can boot an existing data directory. The reason that matters is stated well in the video: "a lot of projects claim to be Postgres compatible — that phrase can mean almost anything. pgrust has a measurable target."

And the counterweight, which the video also supplies rather than leaving to the comments:

"Passing regression tests is not the same as earning production trust. Those tests don't replace years of crash recovery and replication testing, or databases that run for months without stopping. A project can pass every known test and still fail in a situation nobody even thought to test."

That distinction — known tests versus untested situations — is the whole argument about database trust compressed into two sentences, and it is the part worth carrying regardless of what happens to this project.

⏳ The caveat that expired 5:00

The video's structural caution is that everything interesting is out of reach:

"The major performance claims come from the unpublished thread-per-connection version, which right now we can't quite test… the code behind those results is not currently available for any type of inspection or benchmarking."

That was accurate on 17 July. It is not accurate now, and the gap is only thirteen days.

pgrust is on v0.2, and the thread model shipped. The README's "What's new in v0.2" lists "Threads instead of processes, for both connections and parallel query" as a released feature, alongside a vectorized push-based JIT-compiled executor, a query scheduler, work-stealing parallel query, a columnar storage format (pgrcolumnar), pipelined fsync, and a built-in OOM killer. The benchmark harnesses are published in benchmarks/ so the numbers can be reproduced, and there is a full server compiled to WebAssembly running in the browser at pgrust.com.
Worth noting how fast the shelf life is here. A two-week-old video about a fast-moving infrastructure project had its central epistemic caveat overtaken by a release. Nothing the presenter said was wrong when he said it — but anyone acting on this video today would be reasoning from a snapshot that no longer holds. For this category of content, checking the repository before believing the framing is not pedantry; it is the minimum.

📉 The numbers moved down 5:37

The video reports the developers' claims as roughly 50% better on transactional workloads and around 300× Postgres on analytical workloads, and treats them as unverifiable promises. The published numbers are different, and the direction of the difference is the interesting part.

Claim in the videoWhat the README says today
~50% faster, transactional30% higher throughput on sysbench-oltp read-only at 300GB scale
~300× Postgres, analytical"Hundreds of times faster" on ClickBench — and 18.5% faster than ClickHouse
Numbers unverifiableHarnesses published in benchmarks/; reviewed independently by Greg Smith, author of PostgreSQL 9.0 High Performance

The revision is not something a reader had to catch — the maintainers flag it themselves, in a passage headed "two honest caveats":

"We had previously reported that pgrust was over 50% faster than Postgres. On Kubernetes we measure a larger OLTP gap, 50–60% rather than 30%, and we have not isolated why the same binaries behave differently there than on bare EC2, so we quote the lower number."
This is the behaviour you want and almost never see. They have a measurement that flatters them (50–60% on Kubernetes), a measurement that does not (30% on EC2), and no explanation for the divergence — so they publish the lower number and say why. Set that against the vendor benchmark tables elsewhere in this series, where the same competitor scored 40 on one card and 26 on another with no acknowledgement at all. Quoting your worst reproducible result is a much stronger signal than any multiplier.

Also worth separating: "hundreds of times faster than PostgreSQL" on ClickBench is a comparison against a row-store doing analytical work, which is not what Postgres is for. The meaningful figure in that row is 18.5% faster than ClickHouse — a purpose-built columnar engine. That is the claim that would be impressive if it holds, and the one the "300×" headline obscures.

🔬 Four bugs in Postgres 6:52

The video asks the right question — how could anyone trust this? — and answers it with a fair generality about crash recovery and years of production. The README answers it with a testing programme the video does not mention, and one item in it is genuinely remarkable.

Of roughly 3,000 user-facing Postgres functions, 1,000 have been formally verified to behave identically in pgrust using Kani, the Rust model checker. That process found 12 divergences between the two implementations. Four of them were bugs in Postgres itself. Beyond that: simulation testing with Antithesis, and aggressive differential fuzzing against Postgres.
That inverts the framing of the whole video, and deserves to be the headline. The story is not "can the copy be trusted" — it is that building a second implementation strict enough to diff against the original surfaced four defects in a forty-year-old database that everyone already trusts. Independent reimplementation as a bug-finding technique is an old idea in compilers and standards work; seeing it produce results against Postgres is a stronger argument for the project's existence than any benchmark.

The maintainers are also candid about how hard the headline achievement was: getting the regression suite to pass took three failed attempts, and they wrote up the dead ends publicly. That is a detail that makes the 46,066 figure more credible, not less.

🧵 Threads, and what they cost 4:18

The best analytical passage in the video, and it refuses the easy conclusion. Thread-per-connection lowers per-connection overhead and makes sharing state between parts of the database easier. But:

"Separate processes also create useful walls between connections. If one process fails, that separation can help contain the damage. With threads, one unsafe extension or memory bug could affect more of the server. So thread-per-connection is not automatically better. It just opens new doors, but it may also remove some safety rails."

That is exactly right, and the shipped design shows the maintainers reached the same conclusion. Two v0.2 features exist specifically to rebuild the safety rails that processes provided for free:

  • A query scheduler — queries get a priority, and long-running queries have theirs lowered, so heavy queries interfere less with fast ones. Described as new to Postgres.
  • A built-in OOM killer — near the memory limit, pgrust picks a worker to kill so that one query dies instead of the OS killing the whole server.
The OOM killer is the more interesting of the two. In the process model, the operating system's OOM killer can take down your entire database because it has no idea which process matters. Moving that decision inside the database is a direct answer to a real outage class — the maintainers link it to a piece on "the four horsemen behind thousands of Postgres outages". Threading forced the problem; owning the failure decision is the resulting improvement.

On memory safety, the README is precise rather than triumphal: pgrust does use unsafe, specifically where Postgres represents every internal value as an untyped 8-byte Datum and where memory layouts must match byte for byte. "Rewritten in Rust" does not mean "no unsafe code", and they say so.

🔌 Why not an extension 3:10

A clean piece of reasoning that generalises well beyond databases. Three options, three different failure modes:

ApproachLimitation
ExtensionSits on top of the original core — cannot change the architecture underneath
ForkCan change the core, but inherits the architecture and the permanent job of tracking upstream
Independent DB (CockroachDB, YugabyteDB)Free to rearchitect, but exact drop-in compatibility is not the goal
pgrustUses Postgres behaviour as the specification — free to rearchitect while compatibility stays measurable

The elegance is that the regression suite becomes both the constraint and the scoreboard. You can rebuild the executor however you like as long as 46,066 queries still agree.

The gap this leaves is the one that matters commercially, and the README is blunt about it: "Existing PostgreSQL extensions do not work. There is no stable extension ABI in pgrust yet." Some bundled contrib modules are ported; PL/Python, PL/Perl and PL/Tcl are not. For most real deployments the extension ecosystem is Postgres — PostGIS, pgvector, TimescaleDB, pg_stat_statements. Wire compatibility gets you the client; it does not get you the stack you actually run.

🤖 The real experiment is economic 5:05

The video's sharpest reframe, and the reason this belongs in an agents publication rather than a database one:

"The real experiment is not simply 'can Rust make Postgres faster?' It's more like: can AI make a rewrite this large affordable enough that developers can actually rethink the architecture underneath things?"

Michael Malis and Jason Seibel used coding agents heavily. The published release deliberately mirrors the original Postgres structure in many places — which is what makes a differential comparison possible at all — while the architectural changes went into the later work.

The claim being tested is about cost, not capability. Reimplementing a million lines of C with matching semantics was always possible; it was never worth anyone's budget. If agents move that from "unaffordable" to merely "expensive", the interesting consequence is not this database. It is that the set of infrastructure experiments worth attempting gets larger — and that the safest kind of AI-generated code may be code with an executable oracle sitting next to it. pgrust did not have to be judged by review; it had 46,066 tests and a reference implementation to disagree with.

The presenter's closing generalisation is the right one: "we don't need to change the entire Postgres project before learning whether an idea actually works. That freedom may be more valuable than any single benchmark."

⚠️ The Graviton4 footnote 6:55

One qualification appears nowhere in the video and materially narrows every performance number quoted above.

pgrust is tuned for a single processor family. From the README: "pgrust is specifically tuned for Graviton4 and the JIT compiler only targets Graviton4. pgrust will still work on other platforms, but will not have similar performance." The benchmarks ran on an AWS c8g.4xlarge, and the published binaries are generic builds — the maintainers state plainly that "you will not reproduce them exactly from a download" because the benchmark builds used -Ctarget-cpu=neoverse-v2.

So the honest reading of the headline speed claims is: 30% faster than Postgres and 18.5% faster than ClickHouse, on one AWS instance family, with a build you have to make yourself. That is still a real result, and it is a considerably narrower one than "faster than Postgres and ClickHouse" implies.

Two further constraints worth knowing before trying it: pgrust does not yet ship its own initdb or psql, and the project is not accepting pull requests right now — issues yes, code contributions no.

🏦 Reading this as a bank 7:45

The video's verdict is correct and worth repeating verbatim: "Should you replace your production Postgres cluster with pgrust? No, absolutely not." The project says the same about itself — "Do not put data you care about in it."

For a regulated environment the calculus is even simpler, and three items settle it before performance ever comes up:

ConsiderationStatus
Maintainers' own production guidance"Not production ready. Do not put data you care about in it."
LicenceAGPL-3.0 — network-use source obligations, unlike Postgres's permissive licence
Extension ecosystemNo stable ABI; existing extensions do not work
Crash recovery / replication track recordNone yet — the thing regression tests cannot substitute for
Hardware couplingPerformance story is Graviton4-specific
Worth watchingYes — the verification programme and the trust methodology are the transferable part
The licence deserves particular attention because it is a silent change of terms. Postgres ships under the permissive PostgreSQL Licence. pgrust is AGPL-3.0, with portions derived from PostgreSQL retaining the original licence. Swapping a permissively-licensed database for a copyleft one with network-use provisions is a legal decision, not an infrastructure one — and it is exactly the kind of substitution that passes a technical review and fails a legal one. The video never mentions the licence at all.

What is genuinely worth borrowing is the trust methodology: an executable oracle (the regression suite), formal verification of a subset of behaviour, differential fuzzing against the reference, and simulation testing. That template applies to any system where you must prove a new implementation matches an old one — a migration pattern most large institutions run repeatedly, and usually with far weaker evidence than this.

🔍 Claims checked

Every checkable claim was verified against the GitHub API and the project's own README rather than the narration:

ClaimResult
Passes all ~46,000 regression queriesExact figure is 46,066/46,066, stated in the README badge
Works with a normal psql client, boots a Postgres 18.3 data directoryWire and SQL dialect compatible; 18.3 is the stated target
Written in Rust, real query planner and storage enginemalisper/pgrust, Rust, 3,912 stars, 147 forks
Not production readyVerbatim: "Do not put data you care about in it."
Existing extensions don't workConfirmed — no stable extension ABI; PL/Python, PL/Perl, PL/Tcl not ported
Built with heavy use of coding agentsThe maintainers' own framing, in a linked write-up
The thread-per-connection version is unpublished and untestableNo longer true. Shipped in v0.2, with benchmark harnesses published in benchmarks/
~50% faster on transactional workloadsRevised down by the maintainers to 30% on sysbench-oltp; they explain why they quote the lower figure
~300× Postgres on analytical workloadsREADME says "hundreds of times" vs Postgres, and 18.5% vs ClickHouse — the latter is the meaningful comparison
Performance is portableNot stated in the video. Tuned for Graviton4; the JIT targets it exclusively
LicenceNot mentioned in the video. AGPL-3.0, versus Postgres's permissive licence
Formal verification found bugs in PostgresNot mentioned in the video. 1,000 functions verified with Kani, 12 divergences, 4 were Postgres bugs
The pattern to notice. Nothing in the video was false when published on 17 July. But its central caveat expired within thirteen days, its performance figures were revised downward by the maintainers themselves, and the three most decision-relevant facts — the Graviton4 coupling, the AGPL licence, and the formal-verification results — are absent entirely. For fast-moving infrastructure, the repository is the source; the video is a timestamp.

Repository state, star counts and README contents verified 30 July 2026 against HEAD.

💡 Key takeaways

  1. 46,066 of 46,066 regression queries pass. Not "Postgres compatible" as a marketing phrase — a measurable target where the real Postgres tests are the judge.
  2. But passing known tests is not production trust. The video's best line: a project can pass every known test and still fail in a situation nobody thought to test. Crash recovery and replication track records take years, not test runs.
  3. The video's core caveat expired in thirteen days. The "unpublished, unbenchmarkable" thread-per-connection version shipped in v0.2, with harnesses published so you can reproduce the numbers.
  4. The maintainers revised their own claims downward. From "over 50% faster" to 30% — because Kubernetes showed 50–60%, EC2 showed 30%, they could not explain the gap, and so they quote the lower one.
  5. That is the strongest credibility signal in the whole story. Publishing your worst reproducible result, with the reason, beats any multiplier — and stands in sharp contrast to vendor benchmark tables that disagree by 14 points without comment.
  6. The meaningful analytical number is 18.5% vs ClickHouse, not "hundreds of times vs Postgres". Beating a row-store at columnar work is expected; beating a purpose-built columnar engine is the claim worth testing.
  7. Formal verification found four bugs in Postgres itself. 1,000 of ~3,000 user-facing functions verified with Kani, 12 divergences found, four of them defects in the forty-year-old original. Reimplementation as a bug-finding technique.
  8. Threads remove safety rails, and the design admits it. A query scheduler and a built-in OOM killer exist precisely to rebuild what process isolation gave for free.
  9. Owning the OOM decision is a real improvement. The OS killer has no idea which process matters and can take the whole database down; pgrust kills one query instead.
  10. "Rewritten in Rust" does not mean no unsafe code. Postgres's untyped 8-byte Datum and byte-exact memory layouts require it, and the README says so plainly.
  11. Extensions are the commercial gap. No stable ABI, PL/Python, PL/Perl and PL/Tcl unported. For most real deployments the extension ecosystem is Postgres.
  12. The performance story is Graviton4-specific, and the video never says so. The JIT targets it exclusively; published binaries are generic and will not reproduce the benchmarks.
  13. The licence changes, and the video never mentions it. Postgres is permissively licensed; pgrust is AGPL-3.0 with network-use obligations. That is a legal decision wearing an infrastructure disguise.
  14. The real experiment is about cost, not Rust. Can agents make a rewrite this large affordable enough that architecture becomes negotiable? The answer determines which infrastructure experiments are worth attempting at all.
  15. The transferable lesson is the oracle. AI-generated code is safest where an executable reference exists to disagree with it — 46,066 tests plus differential fuzzing plus formal proofs. That template applies to any migration where you must prove new matches old.

🔗 Resources & links

🕐 Timestamp index

0:0046,000 queries pass — and it still isn't production ready
0:32Four decades of architecture, a million lines of C
0:44Process per connection — the overhead it creates
1:00Keep the behaviour, replace the engine
1:18Not an extension, not a feature on top
1:40Testing it — Docker image and a normal psql
1:55Real SQL, real EXPLAIN, an index scan
2:15Inserting 100,000 rows
2:26No dramatic speedup in the released version
2:45What the regression suite actually proves
2:58Real wire protocol, real storage engine
3:10Why not just build an extension?
3:26CockroachDB and Yugabyte have a different goal
3:37Postgres behaviour as the specification
3:54The bigger experiment is in a separate version
4:18The trade-off — processes are walls
4:36Threads open doors and remove safety rails
4:48The second part of the story — AI
5:00Where the performance claims come from
5:05Can AI make a rewrite this large affordable?
5:22Where we need to slow down
5:3750% transactional, 300× analytical
5:46Huge numbers, no inspectable code
5:55Developer reactions — a 50/50 split
6:15Promising claims, not settled facts
6:26The multiplier may not be the point
6:40The Hacker News reaction
6:52"Postgres compatible" can mean almost anything
6:55Production readiness — the other side
7:22Tests don't replace years of crash recovery
7:38Extension compatibility is a major gap
7:45Should you replace production Postgres? No
8:01But should you try it? Sure
8:15Where is this project going?