The article discusses the creation of pg-copyjit, a new JIT compiler for PostgreSQL developed by the author after being inspired by a recently proposed JIT compiler construction methodology. It explores the limitations of using LLVM for JIT compilation in PostgreSQL and introduces the advantages of the copy-and-patch methodology used by pg-copyjit. The author shares insights into the current performance of pg-copyjit, as well as future goals for optimization and expanding architecture support. Links to a research paper that inspired the project, the project’s GitHub repository, and a mentioned tool, PoWA, are also provided.
Main Points
Introduction of pg-copyjit
The author introduced pg-copyjit, a new JIT compiler for PostgreSQL, inspired by a new compiler construction methodology.
Copy-and-patch methodology
pg-copyjit is designed using a copy-and-patch methodology, allowing for faster query execution compared to traditional JIT compilers like LLVM.
Performance and future plans
The current implementation of pg-copyjit shows significant performance improvements and plans for future optimization and support for multiple architectures are outlined.
Limitations of LLVM
The limitations and challenges of using LLVM for JIT compilation in PostgreSQL were highlighted, including its expensive optimization process.
Insights
Introduction of a new JIT compiler for PostgreSQL
After reading a research paper on a new JIT compiler construction methodology, the author was inspired to apply it to PostgreSQL, leading to the creation of pg-copyjit.
Problems with using LLVM for JIT compilation in PostgreSQL
LLVM’s optimizer, though producing efficient code, is expensive for JIT compilation, which makes it unsuitable for quick performance boosts in PostgreSQL.
Advantages of the copy-and-patch methodology
Copy-and-patch allows for quick, on-the-fly compilation by stitching together predefined code stencils, offering a faster alternative to traditional JIT compilers.
Current performance and future goals
The newly developed pg-copyjit shows promising early results in performance tests. The author plans to expand support to other architectures and further optimize the compiler.