How to tell if Postgres was built with the option to include LLVM technology for JIT?

Posted on

Question :

Postgres 11 gained the ability to perform Just-in-Time Compilation (JIT) based on LLVM technology.

The manual notes that this feature depends on Postgres having been built with the --with-llvm option.

➥ How can one verify their build of Postgres includes LLVM?

Assuming LLVM is installed… In Postgres 11, JIT is disabled by default. In Postgres 12, the feature is enabled. That raises the question:

➥ How can one tell if JIT is currently enabled or disabled?

Answer :

Is LLVM built-in?

You can run pg_config --configure to see with which flags and options your version was compiled.

To quote the documentation:

Print the options that were given to the configure script when PostgreSQL was configured for building. This can be used to reproduce the identical configuration, or to find out with what options a binary package was built.

Is JIT enabled?

To check if JIT is enabled, examine the configuration variable named jit.

show jit ;

Is JIT available?

Call the system information function pg_jit_available to see if JIT can be used in this session. Returns false if jit is set to false.

SELECT pg_jit_available() ; 

Leave a Reply

Your email address will not be published. Required fields are marked *