BuildNot yet confirmed elsewhere1 publisher3 min readPublished
pgrust's 5-microsecond compile drags JIT onto the short-query path
If emitting machine code for a query costs 5 microseconds instead of 50 milliseconds, the reason PostgreSQL only JITs long queries goes away. What is left is correctness and one CPU.
The Engineer · Build desk
What happened
- Michael Malis and Jason Seibel say their PostgreSQL rewrite, pgrust, emits query-specific machine code in roughly 5 microseconds.
- The repository puts that against about 50 milliseconds for the LLVM or generated-code path, and says the figure measures compilation, not execution.
- Version 0.2 targets ARM's Neoverse V2, the core in AWS Graviton4, and the repository warns performance elsewhere will not match.
Compiled by The EngineerSomething wrong?How this is made
Why it matters
- capability Compiled execution stops being a tail optimisation for long analytics scans and becomes available to the whole population of short statements, which is most of what a transactional system runs.
- exposure Putting hand-patched machine code in front of every statement changes the failure mode from a slow query to a wrong row, on the path where wrong rows are hardest to notice.
- constraint Adopting pgrust for the compile speed also means adopting Graviton-class hardware as a performance floor; that is procurement, not a config flag you flip later.
- cost The bill so far falls on one founder's equity proceeds, which makes the project's continuity a financing question that no benchmark answers.
The break-even test is the part that moves. PostgreSQL keeps JIT in the analytics box because, by its own documentation, compilation overhead can exceed the time saved on short work [3]. At the roughly 50 milliseconds the pgrust repository attributes to the LLVM or generated-code route [5], that box is drawn tightly: compiling for a statement that would otherwise finish in a millisecond costs fifty times the statement [15]. At 5 microseconds the same compile is half a percent of it [15]. The repository's 10,000-fold figure checks out as arithmetic [14], but the useful reading is not the ratio, it is that the threshold falls below the runtime of nearly every query an OLTP system serves [16].
Copy-and-patch is what buys it. pgrust skips intermediate representation entirely and emits ARM64 instructions, starting from small machine-code templates called stencils and patching in characters, addresses and branch offsets at runtime before joining them, copying them into executable memory and calling the result as an ordinary function [4]. That design moves correctness out of a compiler and into the stencil library. There is no optimizer between intent and bytes, which is why the compile is fast, and also why the review burden is per stencil and per instruction set. pgrust 0.2 aims its JIT at ARM's Neoverse V2, the core in AWS Graviton4, and the repository says pgrust runs elsewhere without comparable performance [9]. Malis's argument for that narrowing is that database workloads land on a small set of cloud hardware, so portability is the thing worth trading [10].
The evidence sits at an awkward distance from the claim. The published execution numbers come from a deliberately limited regular-expression engine that supports literal strings, concatenation and `*` repetition, with no alternation, no lookbehind and no parser [6]. On that engine, Malis's own benchmark had generated code running 12 to 20 times faster than the interpreter and roughly matching handwritten code, and those are demonstration results rather than an independent database test [7]. Three regex constructs is a long way from SQL, and the 5-microsecond figure measures compilation, not execution [5].
Then there is who wrote the instructions. Malis says he had never written assembly before this, his prior exposure being a security challenge, and that a coding agent produced much of the instruction-level work once he had specified the compiler's structure [8]. That is the actual wager: he and Seibel started the rewrite around April 2026 on the view that agents make it affordable to revisit architectural choices a mature database cannot change without breaking installations [12]. Emission is plainly cheaper now. Verification of hand-shaped machine code, multiplied by every stencil and every target you eventually want, is the cost the wager has not yet priced, and it is the cost that grows if pgrust ever needs a second instruction set.
The funding line is consistent with an unpriced bill. Malis said on Postgres FM that he has paid for pgrust personally out of proceeds from selling some Freshpaint equity, that the spending was becoming hard to sustain, and that this prompted work on reducing token use [11]. He is not new to the problem space; per his Y Combinator profile he joined Heap out of high school in 2015 and led work on a roughly petabyte PostgreSQL cluster [13]. The engineering claim and the financing claim are being tested in the same repository.
What to watch
- An independent benchmark on a real database workload, measuring compilation plus execution, rather than the regex demonstration.
- Whether pgrust ships stencils for a second instruction set, and what that does to the maintenance and verification cost it currently avoids.
- Whether pgrust picks up outside funding, given Malis's statement that his personal spending on it is hard to sustain.
Clarity's read
What the record supports and how the coverage leans. The claims behind it follow.
Reality
- Evidence38
- Adoption12
- Hype gap+22
- Incentives62
- Confidence42
Claim ledger
Ranked by verification strength, evidence, and original report placement.
- [1]
Michael Malis and Jason Seibel built pgrust, whose JIT compiler generates query-specific machine code in roughly 5 microseconds, according to Malis.
- [2]
The 5-microsecond compile time is fast enough for pgrust to compile every SQL query before executing it.
- [3]
PostgreSQL already supports JIT compilation through LLVM, and its documentation says the feature is primarily useful for long-running, CPU-bound queries because compilation overhead can exceed the time saved on short work.
- [4]
Instead of handing intermediate code to LLVM or generating C or C++, pgrust directly emits ARM64 machine instructions using a copy-and-patch design: small machine-code templates called stencils are filled in at runtime with values such as characters, addresses and branch offsets, then joined, copied into executable memory and called as a normal function.
- [5]
The pgrust repository compares its roughly 5-microsecond compilation time with about 50 milliseconds for the LLVM or generated-code path, a claimed 10,000-fold reduction; the 5-microsecond figure measures compilation, not query execution.
- [6]
Malis's tutorial applies the technique to a deliberately limited regex engine supporting literal strings, concatenation and repetition with the * operator, leaving out alternation, lookbehind and a parser.
- [7]
In Malis's benchmark, the generated code ran about 12 to 20 times faster than the interpreter and roughly matched code handwritten for the same expression; those results belong to his demonstration benchmark rather than an independent database test.
- [8]
Malis wrote that he has never actually written assembly himself, his previous experience consisting mainly of completing a security challenge, and that a coding agent handled much of the instruction-level work after he specified the compiler's structure.
- [9]
pgrust 0.2's JIT targets ARM's Neoverse V2 architecture used by AWS Graviton4; according to its repository pgrust can run elsewhere, but users should not expect comparable performance.
- [10]
pgrust trades portability for compilation speed because Malis expects database workloads to run on a much smaller set of cloud hardware; general-purpose compiler infrastructure remains the sensible choice when software must support many processors and operating systems.
- [11]
Malis said on Postgres FM that he had personally funded pgrust using proceeds from selling some of his Freshpaint equity, that the spending was becoming difficult to sustain, and that this prompted work on reducing token use.
- [12]
Malis and Seibel began exploring the PostgreSQL rewrite around April 2026 after repeatedly hearing from startups whose reliability problems traced back to databases, and saw AI coding agents as a way to revisit architectural choices a mature database cannot easily replace without breaking existing installations.
- [13]
According to his Y Combinator profile, Malis joined Heap after graduating from high school in 2015 and eventually led work on a PostgreSQL cluster holding about a petabyte of data.
- [14]
Dividing the repository's stated LLVM-path compile time by its stated pgrust compile time gives 10,000, matching the claimed 10,000-fold reduction.
- [15]
For an illustrative query that would run in one millisecond, a 50-millisecond compile costs 50 times the query's runtime, while a 5-microsecond compile costs 0.5 percent of it.
- [16]
runtimewire.com frames the result as follows: cutting JIT startup from about 50 milliseconds to 5 microseconds could bring compiled execution to short queries, though pgrust still has to prove correctness and portability.
ReportedInsufficientSource: runtimewire.com2 sources— create a free account to open themView cited source
Sources
1 independent publisher whose own reporting we read for this story.
- runtimewire.compgrust says its JIT compiles code for every SQL query in 5 microseconds
1 article · August 23, 2026
Topics and entities
Follow any of these and your For You feed starts watching them — no settings page required.