PostgreSQL Begins Landing LLVM JIT Support For Faster Performance

Written by Michael Larabel in LLVM on 22 March 2018 at 08:19 AM EDT. 23 Comments
The widely-used PostgreSQL database software may soon become much faster thanks to a work-in-progress LLVM JIT back-end that has begun to land.

A long-running project has been JIT-compiling SQL queries in PostgreSQL by making use of LLVM's just-in-time compilation support, rather than passing SQL queries through Postgres' interpreter. With the LLVM JIT'ed queries, more efficient code is generated by being able to make more use of run-time information and can especially help in increasing the performance of complex SQL queries.

For those interested in more background information on LLVM JIT'ed PostgreSQL, there is a PDF presentation from last year's PostgreSQL conference about dynamic compilation of SQL queries in PostgreSQL using LLVM JIT.

JIT-compiling expressions for PostgreSQL has been found to be up to ~20%+ faster in database tests like TPC-H. Creating indexes was found to be even 5~19% faster with this JIT mode. Overall, quite promising improvements.

Thus it was exciting to see that overnight the basic JIT provider has landed. It's using an abstraction layer to allow for the just-in-time functionality to be provided by shared libraries, so perhaps in the future we will see support too for GCC's experimental JIT too. Right now the work is focused on LLVM JIT.

Only this first commit has landed so far, but will certainly be interesting to see it continuing to evolve over subsequent commits. It should certainly be exciting come PostgreSQL 11.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week