{"Entry":{"collection":"guc","key":"jit_above_cost","name":"jit_above_cost","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Query Tuning / Planner Cost Constants","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"10","status":"added","to":"11"},{"documentation_changed":true,"fields":{},"from":"11","status":"changed","to":"12"},{"documentation_changed":true,"fields":{},"from":"13","status":"changed","to":"14"},{"documentation_changed":true,"fields":{},"from":"16","status":"changed","to":"17"}],"content_hash":"5ff4340055b7bbfd748932ac2ca357fd08abcbc33fca5a8f96a1c5552ca07ad4","context":"","default_changed_in":[],"default_history":[{"from":"11","to":"19","value":"100000"}],"editorial":{"advice":{"olap":"For long CPU-bound queries, benchmark total elapsed time on both sides of jit_above_cost. Lowering the threshold is useful only when saved execution CPU consistently exceeds compilation overhead.","oltp":"Do not lower jit_above_cost globally to chase a single CPU-heavy statement. Compilation latency is visible in short-query tails; test at statement or role scope and include JIT generation time in the result.","small":"Keep the default or disable the stage with -1 when LLVM work competes with a small CPU budget. Estimated cost alone does not prove that JIT will pay back its startup cost."},"mechanism":["jit_above_cost compares the finished plan's estimated cost with a threshold to decide whether PostgreSQL may start JIT compilation. The cost is the planner's arbitrary estimate, not milliseconds.","The decision occurs at plan time and only matters when JIT is enabled and a provider is available. Generic prepared plans retain the decision made when the generic plan was generated.","A value of -1 disables this stage. jit_inline_above_cost and jit_optimize_above_cost are additional gates after jit_above_cost, so setting either below the base compilation threshold is not meaningful. Its user context permits session- or transaction-local changes; newly performed or newly planned work sees the value."],"pitfalls":["Reading the threshold as milliseconds rather than arbitrary planner cost units.","Ignoring JIT generation, inlining, optimization, and emission time when benchmarking.","Expecting a changed value to alter a generic plan that was already generated.","Setting an advanced-stage threshold below jit_above_cost and expecting that stage to run by itself."],"references":[{"title":"PostgreSQL 19 Beta 4: jit_above_cost","url":"https://www.postgresql.org/docs/19/runtime-config-query.html#GUC-JIT-ABOVE-COST"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["jit","jit_inline_above_cost","jit_optimize_above_cost","jit_expressions"],"summary":"jit_above_cost — Perform JIT compilation if query is more expensive. Observed in PG11–19 Beta 4; its last measured boot default is 100000 in PG19 Beta 4, with user context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"11","group":"Query Tuning","group_slug":"query","imported_at":"2026-09-27T17:57:31.423606+08:00","intro_commit":{"authored_at":"2018-03-22T11:45:07-07:00","discussion":["https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de"],"hash":"cc415a56d09a8da7c919088036b6097b70f10791","subject":"Basic planner and executor integration for JIT.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=cc415a56d09a8da7c919088036b6097b70f10791"},"key":"jit_above_cost","last_version":"20","max_val":"","min_val":"","name":"jit_above_cost","position":191,"present_in":["11","12","13","14","15","16","17","18","19","20"],"short_desc":"Sets the query cost above which JIT compilation is activated, if enabled (see Chapter 30).","short_desc_zh":"","source_rev":"english-manuals:cb9887aaa548e8c55fecbc4e64dc95bf7c6497e1f2cc4a14eb7b35ffffa590d0","unit":"","vartype":"real"}},"Definition":{"Collection":"guc","Key":"jit_above_cost","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"jit_above_cost","SourceRevision":"english-manuals:cb9887aaa548e8c55fecbc4e64dc95bf7c6497e1f2cc4a14eb7b35ffffa590d0","Facts":{"boot_val":"100000","category":"Query Tuning / Planner Cost Constants","context":"user","description":"Sets the query cost above which JIT compilation is activated, if enabled (see Chapter 30). Performing JIT costs planning time but can accelerate query execution. Setting this to -1 disables JIT compilation. The default is 100000.","doc":{"anchor":"GUC-JIT-ABOVE-COST","file":"runtime-config-query.html","lang":"en","sha256":"33456ca7ef52bf28e93e34b932a411db7a1b95800179add2cf867dc6ec9144bc","slug":"18"},"documented":true,"enumvals":null,"extra_desc":"-1 disables JIT compilation.","lang":"en","max_val":"1.79769e+308","metadata_version":"18","min_val":"-1","name":"jit_above_cost","short_desc":"Perform JIT compilation if query is more expensive.","source":"pg-settings-source-snapshot","unit":null,"vartype":"real"},"ManualEvidence":{"doc":{"anchor":"GUC-JIT-ABOVE-COST","file":"runtime-config-query.html","lang":"en","sha256":"33456ca7ef52bf28e93e34b932a411db7a1b95800179add2cf867dc6ec9144bc","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"jit_above_cost","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"jit_above_cost","Summary":"","BodyHTML":"\u003cp\u003e设置激活JIT编译的查询代价，如果查询代价超过这个值就会激活JIT编译（如果启用了JIT，见\u003ca href=\"/docs/18/jit.html\" rel=\"nofollow\"\u003e第 30 章\u003c/a\u003e）。执行JIT会消耗一些规划时间，但是能够加速查询执行。将这个值设置为\u003ccode\u003e-1\u003c/code\u003e会禁用JIT编译。默认值是\u003ccode\u003e100000\u003c/code\u003e。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"6006e6d96e539476afd1f34577f15a19841529f32895a6bb31e4c513a3fff68b","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e设置激活JIT编译的查询代价，如果查询代价超过这个值就会激活JIT编译（如果启用了JIT，见\u003ca href=\"/docs/18/jit.html\" title=\"第 30 章 即时编译（JIT）\"\u003e第 30 章\u003c/a\u003e）。执行JIT会消耗一些规划时间，但是能够加速查询执行。将这个值设置为\u003ccode class=\"literal\"\u003e-1\u003c/code\u003e会禁用JIT编译。默认值是\u003ccode class=\"literal\"\u003e100000\u003c/code\u003e。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
