logoalt Hacker News

Better JIT for Postgres

142 pointsby vladichlast Wednesday at 6:17 AM69 commentsview on HN

Comments

erulast Wednesday at 7:48 AM

> However, standard LLVM-based JIT is notoriously slow at compilation. When it takes tens to hundreds of milliseconds, it may be suitable only for very heavy, OLAP-style queries, in some cases.

I don't know anything here, but this seems like a good case for ahead of time compilation? Or at least caching your JIT results? I can image much of the time, you are getting more or less the same query again and again?

show 2 replies
hinkleylast Wednesday at 8:51 PM

I’m always surprised to learn LLVM is so slow given that was one of the original motivations for developing it. I don’t know if that’s down to feature creep or intrinsic complexity being higher than people presumed was the case for GCC.

sourcegriftlast Wednesday at 9:54 AM

We have everything optimized, and yet somehow DB queries need to be "interpreted" at runtime. There's no reason for DB queries to not be precompiled.

show 6 replies
fabian2klast Wednesday at 8:29 AM

The last time I looked into it my impression was that disabling the JIT in PostgreSQL was the better default choice. I had a massive slowdown in some queries, and that doesn't seem to be an entirely unusual experience. It does not seem worth it to me to add such a large variability to query performance by default. The JIT seemed like something that could be useful if you benchmark the effect on your actual queries, but not as a default for everyone.

show 1 reply
the_biotlast Wednesday at 11:29 AM

What sort of things are people doing in their SQL queries that make them CPU bound? Admittedly I'm a meat-and-potatoes guy, but I like mine I/O bound.

Really amazed to see not one but several generic JIT frameworks though, no idea that was a thing.

show 5 replies
swaminarayanlast Wednesday at 10:23 AM

Have you tested this under high concurrency with lots of short OLTP queries? I’m curious whether the much faster compile time actually moves the point where JIT starts paying off, or if it’s still mostly useful for heavier queries.

show 1 reply
larodilast Wednesday at 10:07 AM

sadly, no windows version yet AFAICT

asahlast Wednesday at 7:50 AM

awesome! I wonder if it's possible to point AI at this problem and synthesize a bespoke compiler (per-architecture?) for postgresql expressions?

show 1 reply