Live data from Hacker News

Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

github.com

631–640 of 756 posts

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#632

Hey author here. Wasn't expecting to see this up. To concisely give an overview of the project, I've been experimenting with using LLMs to build a better version of Postgres. Postgres is 30 years old and we've learned a lot about databases since hten. A lot of the techniques that work for doing a rewrite are also useful for doing a rearchitecture. I'm now working on a new, not yet published version of pgrust that inc…

I don't want to knock you down as most have already did. In-fact it's a useful exercise going forward in exploring how to work with AI. It's here, we're all going to use it one way or the other. Zero issues with that, in-fact kudos to going through the pain of it all.

Now, having gone through several such endeavors originally myself, albeit with internal tools and systems (as an exercise), I've noticed that while all my tests passed with flying colors the rewrite itself was broken even on basic functionality or missed a ton of details. It was in effect useless when I dived into it. Initial tests also showed massive gain in performance, and I know people who were involved aren't really dumb so something smelled funny. Turns out all those things left out and honestly... moments were the key ingredients.

What I did learn from those beginning explorations though was that one-shotting, grand architecture or source up-front, master plans up-front.. all these do not yield good results - YET. Who know what we'll see in few years though. What I did found that works (FOR ME, nota bene) is to keep the design and checklists for myself, written by myself and then do a small piece by piece.. as if you would if you were coding alone or if you would waterfalling a small team of talented juniors. Then, suddenly super happy results come out, but then it's mostly you driving all the way where llm writes code and offers advice (which for the most part you ignore). It's a happy place for myself at least. It's then truly unlocking yourself to the mythical 10x.

Rewriting a large proven system with decades of ultra expertise behind it, which I don't have, is guaranteed not to end up the same 1:1 replacement. If you found a recipe for that - please do share.

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#634
post #560
post #78

How would one go about reviewing a piece of code like this? One of the things I'd typically do is peek at the commit history. Seeing what people worked on and how they did it tends to say a lot about a project. But with LLMs generating 7101 commits in less than a month that isn't feasible. Even looking at a single day is way too much [1]. It probably also doesn't make sense since the commits content won't tell you mu…

I started by looking at the dependencies. Then I lost count, so I ran wc -l Cargo.lock 1467 Cargo.lock Easily over a thousand dependencies. And "rewritten in Rust" is supposed to be a good thing? I bet this doesn't even compile faster than the original.

In a typical Rust project you organize your project into many crates. I haven't checked, but I'd guess that the vast majority of those dependencies are internal dependencies. After all, this project started by running an automated C to Rust converter, which the authors claimed produced over a thousand crates.

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#635

Earlier quoted context omitted.

Code is code. It either does the job or doesn't. If there is nothing that could convince you that AI generated code is trustworthy (for whatever definition of trust) then this is an article of faith, not a rational position.

> Code is code. It either does the job or doesn't. Surely that is not the only dimension that matters when evaluating software. Maintainability and readability, for example, are crucial for any long-lived project.

In the future, code readability will not really matter, the concept of maintainability will also change: Is it maintainable by AI, if yes, then it's maintainable, we will approach the day where we have virtually ZERO code written by human, so all the tools must be built for AIs, not humans anymore.

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#636

Earlier quoted context omitted.

I mean you can learn a lot. You can learn what's possible with less effort to build a proof of concept. It's kind of like you had another engineer do it for you, you don't completely learn how to do it yourself but you can still learn a lot with much less effort

You would learn way more by asking an LLM how postgres works. Nobody is even reading this Rust code. There are 7000 commits over 2 weeks. What is being learned from that?

You learn that you can build a version of Postgres that passes the tests and improves on these benchmarks in rust. You gain access to a codebase that does it which you can learn a lot from too. Definitely not zero like someone else said

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#637
post #26

What would be interesting is if they found a memory unsafe bug. Postgres is a perfect case study of 30 years of C with a bit of CPP; if rewriting in a safer language didn't find anything...

C programmer have learned how to deal with memory problems and have whole suites of tools for finding them. Is it cheaper to find them at compile time rather than runtime? Yes. But it’s not an unsolved problem. Memory bugs are a known unknown.

except that lately we've had a ton of CVE related to memory, so in practice it's not exactly right.

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#638
post #626

If you can do a Rust rewrite with AI, I can create one as well. What makes yours better than mine? Your decade long expertise in database or Rust language? Your reputation? Your proven track record to manage large, complex projects? Your time committed to the project? I don't see any of that. I don't know why anyone would choose this over the actively (community) maintained proper Postgres project.

There’s no claim being made that your rewrite cannot be better.

He has provided benchmark results which provide a dimension amongst which to measure your rewrite. If you can do better by all means post your rewrite.

Finally, these kind of projects can eventually over time become projects that are actively used. Postgres is not some entity that existed before the universe was created; it was also created by someone and then eventually adoption picked up over time.

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#639
post #216

I suspect the future of open source will be to never publish your tests. Or someone will just pump them into an LLM like this.

SQLite already does this but hasn’t stopped the rust /go clones from popping up . These are toy projects with no serious interest in maintaining the port long term. and even with things like bun where the port is merged it remains to be seen on maintainability over time.

> These are toy projects with no serious interest in maintaining the port long term.

source?

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#640
post #584

Don’t understand these rewrites. - typically they are behind a single person. That’s usually bad because of spf - typically they are achieved in a very short amount of time, so the author hasn’t acquired any discipline in creating the project. That means it’s unlikely the author is going to stick to the project in the mid and long term - anyone that wants to contribute to the project needs to pay. Needs to pay tokens…

This is very critical of an open source project that the maintainer didn't even post here? "Status: pgrust is not production-ready yet. It is not performance optimized yet." The maintainer is not suggesting you use this for anything yourself. So why do you care about spf or (lol) his "discipline in creating the project"?

100%

People on HN love complaining at any given moment.

I’d wager most of these people don’t really produce much and are constantly bikeshedding.

Post reply on HN