Sets the query cost above which JIT compilation applies expensive optimizations.
At a glance
| Property | Value |
|---|---|
| Parameter | jit_optimize_above_cost |
| Category | Query Planning |
| Default | 500000 |
| Value type | floating point |
| Change scope | Per-session (SET) |
| Available in | PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12) |
What it does
Sets the query cost above which JIT compilation applies expensive optimizations. Such optimization adds planning time, but can improve execution speed. It is not meaningful to set this to less than jit_above_cost, and it is unlikely to be beneficial to set it to more than jit_inline_above_cost. Setting this to -1 disables expensive optimizations. The default is 500000.
(Description quoted from the official PostgreSQL documentation.)
How to apply a change
Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.
Inspect the current value and source with SHOW jit_optimize_above_cost; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'jit_optimize_above_cost';.
Tuning guidance
Raise it to skip the LLVM optimization pass on queries too short to amortize it; -1 disables optimization. It only matters when JIT is enabled and triggered.