Configuring JIT

In order to use JIT, it has to be added at compile time. The following configure options are available:

 --with-llvm build with LLVM based JIT support
...
LLVM_CONFIG path to llvm-config command

Some Linux distributions ship an extra package containing support for JIT. If you want to make use of JIT make sure those packages are installed.

Once you have made sure, JIT is available, the following configuration parameters will be available to fine-tune JIT compilation for your queries:

#jit = on                               # allow JIT compilation
#jit_provider = 'llvmjit' # JIT implementation to use
#jit_above_cost = 100000 # perform JIT compilation if available
# and query more expensive, -1 disables
#jit_optimize_above_cost = 500000 # optimize JITed functions if query is
# more expensive, -1 disables
#jit_inline_above_cost = 500000 # attempt to inline operators and
# functions if query is more expensive,
# -1 disables

jit_above_cost means that JIT is only considered if the expected cost is at least 100.000. Why is that relevant? If a query is not sufficiently long the overhead of compilation can be a lot higher than the potential gain. Therefore optimization is only attempted. However, there are two more parameters: Really deep optimizations are attempted if the query is considered to be more expensive than 500.000. In this case function calls will be inlined and all that.

At this point PostgreSQL only supports LLVM as a JIT backend. Maybe additional backends will be available in the future as well. For now LLVM does a really good job and covers most environments used in professional environments.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset