{"Entry":{"collection":"guc","key":"jit","name":"jit","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Query Tuning / Other Planner Options","category_zh":"","changed_in":["12","19"],"changes":[{"documentation_changed":false,"fields":{},"from":"10","status":"added","to":"11"},{"documentation_changed":true,"fields":{"boot_val":{"from":"off","to":"on"}},"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"},{"documentation_changed":true,"fields":{"boot_val":{"from":"on","to":"off"}},"from":"18","status":"changed","to":"19"}],"content_hash":"a15379283ce84055a4031e75674d172c56ea5a05d907e4469c9da848f9156742","context":"","default_changed_in":["12","19"],"default_history":[{"from":"11","to":"11","value":"off"},{"from":"12","to":"18","value":"on"},{"from":"19","to":"19","value":"off"}],"editorial":{"advice":{"olap":"Keep it available and benchmark CPU-heavy aggregates, expressions, and scans. Judge total execution time, including generation, inlining, optimization, and emission overhead.","oltp":"Leave the default thresholds high or disable JIT if compilation latency appears in short-request tails. Test at the statement or role level before changing it cluster-wide.","small":"On small CPU-constrained systems, JIT often has little benefit for ordinary queries. Keeping it on with conservative thresholds is different from lowering thresholds to force compilation."},"mechanism":["The jit switch is the top-level gate. When it is on, jit_above_cost decides whether compilation starts, while jit_inline_above_cost and jit_optimize_above_cost govern additional, more expensive compilation work.","JIT is mainly beneficial for long-running CPU-bound queries, often analytical ones. Compilation adds latency, so short statements can become slower if thresholds are lowered too aggressively.","The decision is made at plan time. For a prepared statement using a generic plan, the settings active when that plan is prepared control the decision; EXPLAIN ANALYZE reports whether JIT ran and how much time its phases consumed."],"pitfalls":["jit=on does nothing if PostgreSQL was built without an available JIT implementation.","On does not mean every query is compiled; cost thresholds still gate execution.","Lowering thresholds can make short queries slower than interpreted execution.","Generic prepared plans use the configuration in effect when the plan was prepared.","Estimated cost is not execution time, so threshold behavior must be measured with representative plans."],"references":[{"title":"PostgreSQL 19 Beta 4: jit","url":"https://www.postgresql.org/docs/19/runtime-config-query.html#GUC-JIT"},{"title":"PostgreSQL 18: When to JIT?","url":"https://www.postgresql.org/docs/18/jit-decision.html"},{"title":"PostgreSQL 18: JIT Configuration","url":"https://www.postgresql.org/docs/18/jit-configuration.html"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["jit_above_cost","jit_inline_above_cost","jit_optimize_above_cost","jit_provider","plan_cache_mode","jit_expressions"],"summary":"Allows PostgreSQL to use just-in-time compilation when the build provides a JIT implementation and the plan's estimated cost crosses the configured thresholds. Enabling it does not force JIT for every query."},"enumvals":[],"first_version":"11","group":"Query Tuning","group_slug":"query","imported_at":"2026-09-27T17:57:31.420473+08:00","intro_commit":{"authored_at":"2018-03-21T19:28:28-07:00","discussion":["https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de"],"hash":"432bb9e04da4d4a1799b1fe7c723b975cb070c43","subject":"Basic JIT provider and error handling infrastructure.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=432bb9e04da4d4a1799b1fe7c723b975cb070c43"},"key":"jit","last_version":"20","max_val":"","min_val":"","name":"jit","position":190,"present_in":["11","12","13","14","15","16","17","18","19","20"],"short_desc":"Determines whether JIT compilation may be used by PostgreSQL, if available (see Chapter 30).","short_desc_zh":"","source_rev":"english-manuals:8ed9c8f6a2368efa6c4041f572f7f0bbff789dc00f2e385dfd7a64d4d064c363","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"jit","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"jit","SourceRevision":"english-manuals:8ed9c8f6a2368efa6c4041f572f7f0bbff789dc00f2e385dfd7a64d4d064c363","Facts":{"boot_val":"on","category":"Query Tuning / Other Planner Options","context":"user","description":"Determines whether JIT compilation may be used by PostgreSQL, if available (see Chapter 30). The default is on.","doc":{"anchor":"GUC-JIT","file":"runtime-config-query.html","lang":"en","sha256":"33456ca7ef52bf28e93e34b932a411db7a1b95800179add2cf867dc6ec9144bc","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"jit","short_desc":"Allow JIT compilation.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-JIT","file":"runtime-config-query.html","lang":"en","sha256":"33456ca7ef52bf28e93e34b932a411db7a1b95800179add2cf867dc6ec9144bc","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"jit","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"jit","Summary":"","BodyHTML":"\u003cp\u003e决定如果可用（见\u003ca href=\"/docs/18/jit.html\" rel=\"nofollow\"\u003e第 30 章\u003c/a\u003e），\u003cspan\u003ePostgreSQL\u003c/span\u003e是否可以使用JIT编译。默认值是\u003ccode\u003eon\u003c/code\u003e。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"693e6d11973dce7e0b4efe76f9c7bbc775671002aef6bb13285f16457b7d99ec","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e决定如果可用（见\u003ca href=\"/docs/18/jit.html\" title=\"第 30 章 即时编译（JIT）\"\u003e第 30 章\u003c/a\u003e），\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e是否可以使用JIT编译。默认值是\u003ccode class=\"literal\"\u003eon\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}
