PostgreSQL Begins Landing LLVM JIT Support For Faster Performance
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.