Programming at Light Speed: Building the Gravity Query Engine

poly2it 18 points 7 comments October 30, 2026
pgrust.com · View on Hacker News

Discussion Highlights (3 comments)

cube2222

After the recent somewhat discouraging stuff with clickbench that made the news, I must say this blog post is very cool. Sounds like you found an excellent way of structuring this problem to solve it with Claude (for those who don't click into the article - writing hand/claude-optimized Rust code for each query, checking its assembly, and trying to make their own optimizer generate something close to that same assembly), and the writeup is very interesting and readable too! Kudos, looking forward to more blog posts like this one.

agumonkey

Are the pgrust guys lisper historically ?

landhar

> Normally, when engineers try to make software faster, they work from the bottom up. They run a benchmark, look at a flamegraph, find a hotspot, and figure out how to speed up their code by 15% or 20%. The problem with working from the bottom up is that you don't know what the ceiling is. You might be 20% away from the fastest possible code the hardware can run, or you might be 100x away. > When we started building Gravity, we flipped this question around. We asked ourselves: how fast can a database actually be? Instead of incrementally speeding up our existing query engine, we wanted to start from the physical speed limit of our hardware and file format and work backward. I like to call this “programming at light speed”. What is described as the “normal” approach to optimizing code is really more the “naïve” approach. Any serious performance optimization work would follow the approach of defining first what’s the ceiling the hardware allows and benchmark against that. And that was already true before LLMs. See for example: https://www.marginalia.nu/log/a_106_native_calls/ Apologies for being nitpicky, but I felt it might be useful for other readers to contextualize that this part of the approach is not novel. Their use of Claude to generate those optimized benchmarks is interesting enough already, so I don’t feel that calling extra attention to this part in their write up is necessary.

Semantic search powered by Rivestack pgvector
11,107 stories · 104,858 chunks indexed