]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
jit: Change the default to off.
authorTomas Vondra <tomas.vondra@postgresql.org>
Thu, 2 Apr 2026 10:53:18 +0000 (12:53 +0200)
committerTomas Vondra <tomas.vondra@postgresql.org>
Thu, 2 Apr 2026 11:40:29 +0000 (13:40 +0200)
While JIT can speed up large analytical queries, it can also cause
serious performance issues on otherwise very fast queries. Compiling
and optimizing the expressions may be so expensive, it completely
outweighs the JIT benefits for shorter queries.

Ideally, we'd address this in the cost model, but the part deciding
whether to enable JIT for a query is rather simple, partially because we
don't have any reliable estimates of how expensive the LLVM compilation
and optimization is.

Sometimes seemingly unrelated changes (for example a couple additional
INSERTs into a table) increase the cost just enough to enable JIT,
resulting in a performance cliff.

Because of these risks, most large-scale deployments already disable JIT
by default. Notably, this includes all hyperscalers.

This commit changes our default to align with that established practice.
If we improve the JIT (be it better costing or cheaper execution), we
can consider enabling it by default again.

Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://postgr.es/m/DG1VZJEX1AQH.2EH4OKGRUDB71@jeltef.nl

doc/src/sgml/config.sgml
src/backend/jit/jit.c
src/backend/utils/misc/guc_parameters.dat
src/backend/utils/misc/postgresql.conf.sample

index 229f41353ebb2cbe49f7e38f85040eaad96c2b7c..fdb77df0fdbe791403f5d4f3623cc4c5cc729248 100644 (file)
@@ -6591,7 +6591,7 @@ SELECT * FROM parent WHERE key = 2400;
         Determines whether <acronym>JIT</acronym> compilation may be used by
         <productname>PostgreSQL</productname>, if available (see <xref
         linkend="jit"/>).
-        The default is <literal>on</literal>.
+        The default is <literal>off</literal>.
        </para>
       </listitem>
      </varlistentry>
index fd930bdca3a072dfa93921fde91f601fe08a9219..3dc82b7b268bc61aa77ea34131c80ca7ef926cfd 100644 (file)
@@ -30,7 +30,7 @@
 #include "utils/fmgrprotos.h"
 
 /* GUCs */
-bool           jit_enabled = true;
+bool           jit_enabled = false;
 char      *jit_provider = NULL;
 bool           jit_debugging_support = false;
 bool           jit_dump_bitcode = false;
index 0a862693fcd6590c5e2223f4ffe534a193e4700c..e556b8844d8d0eca5f57d698a3f5287f0b9ecd1c 100644 (file)
   short_desc => 'Allow JIT compilation.',
   flags => 'GUC_EXPLAIN',
   variable => 'jit_enabled',
-  boot_val => 'true',
+  boot_val => 'false',
 },
 
 { name => 'jit_above_cost', type => 'real', context => 'PGC_USERSET', group => 'QUERY_TUNING_COST',
index cf15597385b941b6021b3faf515d830aa66e6c55..2c5e98d1d4ddf62da417e73405174167da89bff0 100644 (file)
 #constraint_exclusion = partition       # on, off, or partition
 #cursor_tuple_fraction = 0.1            # range 0.0-1.0
 #from_collapse_limit = 8
-#jit = o                              # allow JIT compilation
+#jit = off                              # allow JIT compilation
 #join_collapse_limit = 8                # 1 disables collapsing of explicit
                                         # JOIN clauses
 #plan_cache_mode = auto                 # auto, force_generic_plan or