A long analytical query still runs slowly, and PostgreSQL 19 has JIT turned off by default.
Fast answer: Keep JIT off for short or transaction-heavy workloads. Test it on a representative, CPU-bound analytical query before enabling it. Treat the execution plan and repeatable measurements—not the default setting—as the decision.
This guide is for DBAs planning to use PostgreSQL 19, data teams running long analytical queries, and SaaS technical leads assessing database resources.
Last updated November 20, 2026. We checked the release and behavior against the PostgreSQL 19 release announcement and the version 19 JIT documentation.
What the PostgreSQL 19 default means
The PostgreSQL project announced PostgreSQL 19 on November 19, 2026, and confirmed that JIT is disabled by default in this release. The release note is a description of the default, not a universal recommendation to switch JIT on for analytics. PostgreSQL’s own guidance says large analytical queries may need JIT enabled, but does not promise that every such query will benefit. See the official release announcement and PostgreSQL 19 release notes.
That distinction matters during configuration reviews. A default can be a reasonable baseline for a broad range of workloads without being optimal for a particular database. If you upgrade and leave JIT disabled, that is not automatically a misconfiguration. If you enable it everywhere because your system runs reports, that is not automatically an improvement either.
JIT compiles parts of a query plan to reduce the cost of some operations during execution. Compilation itself takes time and consumes resources. It can be worthwhile when the work saved during execution exceeds that upfront cost. For a short query, the compilation work may be a larger part of the total runtime than the work it saves. The PostgreSQL JIT decision guide explains why the cost and expected benefit depend on the query.
Use this decision boundary:
- Keep the default for short transactions and queries unless measurements show a repeatable reason to change it.
- Test JIT for long analytical queries that appear to be CPU-bound.
- Do not treat a large dataset or a large scan by itself as proof that JIT will help.
- Keep JIT off when test results are inconsistent or compilation costs cancel out any execution benefit.
Query characteristics that justify a test
Start with the work the query performs, not just the name of the application or the size of its tables. JIT is most relevant when the plan spends meaningful time evaluating expressions or performing other work that can benefit from compilation. It is less compelling when the query finishes quickly, spends most of its time waiting on I/O, or is repeated so frequently that compilation overhead becomes a recurring cost.
A short transaction usually has little time in which to recoup compilation overhead. The same can be true of a frequently executed query, even if it looks computationally nontrivial in isolation. If the query is called over and over, test the real pattern of calls rather than an occasional execution with idealized conditions.
Long-running analytical work is a stronger candidate for evaluation, but “long-running” is only a reason to investigate. It is not a diagnosis. A query may take a long time because it reads data from storage, waits on locks, spills work to temporary files, or uses a poor plan. JIT does not correct those causes. Check the plan and its execution evidence before attributing runtime to CPU expression work.
The distinction between a scan-heavy plan and a CPU-bound plan is useful here. A scan can be limited by storage throughput or cache state. Adding compilation to an I/O-bound query may add work without reducing the main wait. Conversely, a plan that repeatedly evaluates complex expressions may be worth testing even if its table size does not look exceptional.
PostgreSQL’s JIT documentation describes the operations JIT can accelerate and the relationship between JIT and query execution. Use it to frame a test, not to assume a result in advance.
Plan and runtime evidence
First inspect the plan. Use the same representative query and parameters that the application or reporting job uses. In a controlled test environment, run:
EXPLAIN (ANALYZE, BUFFERS, SETTINGS)
SELECT ...
FROM ...
WHERE ...;
Replace the abbreviated query with the real statement. ANALYZE executes the query, so do not run it casually against production work that could create load, lock sensitive data, or perform side effects. For a safe read-only query, a test system with representative data is generally a better place to begin. The PostgreSQL EXPLAIN guide explains how to read plans and what ANALYZE adds.
When execution uses JIT, inspect the JIT details in the output. Depending on the plan and settings, the output can include information about generated functions and compilation work. The relevant point is not to copy a JIT block into a report and call it a win. It confirms that JIT was involved; it does not establish that the query ran faster.
Keep these forms of evidence separate:
- Plan evidence: What operations PostgreSQL chose, including row estimates, actual rows, loops, and buffer activity.
- JIT evidence: Whether execution included JIT information and what compilation work the output reports.
- Performance evidence: How long the query took under controlled, comparable conditions.
A plan may contain JIT details while the total runtime stays the same or becomes worse. It may also change between runs for reasons unrelated to JIT. Record the plan alongside each measurement so that a changed runtime is not mistakenly credited to compilation when the underlying plan or test conditions changed.
For recurring statements, use pg_stat_statements as a way to identify and compare query patterns over time. It provides statistics about statements, but does not replace a controlled on/off test of one representative query. The PostgreSQL 19 pg_stat_statements documentation describes the extension and its statistics.
A controlled JIT comparison
Run the test away from live traffic where possible. Keep the query text, parameters, data state, cache conditions, and surrounding workload consistent. Change one variable at a time. A comparison that changes JIT, query parameters, data freshness, and server load together cannot tell you which change caused the result.
For a session-scoped trial, PostgreSQL supports the jit setting. The PostgreSQL 19 JIT configuration reference documents it and related configuration options.
SET jit = off;
EXPLAIN (ANALYZE, BUFFERS, SETTINGS)
SELECT ...
FROM ...
WHERE ...;
SET jit = on;
EXPLAIN (ANALYZE, BUFFERS, SETTINGS)
SELECT ...
FROM ...
WHERE ...;
Use a dedicated test session and make sure each run uses the intended setting. If the application uses prepared statements or connection pooling, account for that behavior: the setting and query execution path in a one-off SQL session may not match the application’s real environment. Avoid making a global configuration change just to test a query.
The comparison should answer more than “which run was faster?” Record execution time, plan shape, buffer activity, row and loop behavior, and the JIT information reported by the plan. Repeat the comparison under comparable conditions. A single run can be affected by cache state, background work, or other temporary differences. We do not provide a performance percentage here because no reproducible NetAmd JIT benchmark is available for this workload.
A practical result can be a decision to keep the default. If the test shows no stable benefit, if compilation work is substantial relative to execution, or if the plan changes unpredictably, leave JIT disabled while you investigate the plan or the workload. Do not turn a noisy measurement into a production setting.
FAQ
Why is JIT disabled by default in PostgreSQL 19?
JIT compilation adds work before a query runs. That work can outweigh any execution savings for short or frequently repeated queries. PostgreSQL 19 therefore avoids enabling JIT by default, while leaving teams free to test it for suitable workloads. The setting is a safer starting point, not a claim that JIT never helps.
Should I enable JIT for analytical queries in PostgreSQL 19?
Test it when a representative analytical query spends substantial time doing CPU-bound expression evaluation. A large table scan alone is not enough evidence. Compare the same query and data with JIT off and on, and keep the setting disabled if compilation costs erase the benefit or results vary between runs.
How can I confirm that a PostgreSQL query actually used JIT?
Run EXPLAIN with ANALYZE in a safe test environment and inspect the execution output for a JIT section. A planned query without execution does not establish that JIT ran. Also record the plan and runtime separately: seeing JIT details confirms use, but does not prove that the query became faster.
Which metrics should I compare after enabling PostgreSQL JIT?
Compare total execution time, plan shape, rows and loops, buffer activity, and the JIT compilation details shown by EXPLAIN ANALYZE. Use the same query, data state, parameters, and test conditions for both settings. Repeat runs and compare the pattern, rather than treating one unusually fast or slow execution as a result.
The decision checklist
Use this checklist before changing a PostgreSQL 19 setting:
- [ ] Identify a real analytical query that matters to the workload; do not choose a query only because it has a large scan.
- [ ] Capture its plan and execution evidence with
EXPLAIN (ANALYZE, BUFFERS, SETTINGS)in a safe test environment. - [ ] Check whether the query appears CPU-bound, or whether storage waits, locks, spills, or plan issues are more likely to explain its runtime.
- [ ] Run the same query with JIT off and on while keeping parameters, data, and test conditions consistent.
- [ ] Record execution time, plan changes, buffer activity, and the JIT compilation details.
- [ ] Repeat the comparison. Keep JIT off if the result is unstable, the added compilation work is not recovered, or the test does not show a useful improvement.
- [ ] Validate the chosen setting against the application’s real connection and query behavior before changing production configuration.
Turning query results into server planning
Use test results to describe the workload before selecting or changing server resources. Record whether the query is CPU-bound, whether its plan is stable, how it behaves with JIT on and off, and whether the test resembles production traffic. Those observations help assess database needs. They do not, by themselves, prove that a particular CPU, memory capacity, or storage layout will improve JIT performance.
For database hosting, compare the resources and operating conditions that matter to the measured workload. CPU availability affects compute-bound work; memory affects working sets and cache behavior; storage matters when the plan is limited by data access. Confirm current selectable options against the NetAmd server pricing and configuration page rather than treating a general resource description as a JIT performance promise. The NetAmd service questions page is also available for checking service details before planning a deployment.
Dedicated hardware can provide a different resource model from shared instances, but it does not make a database durable by itself. PostgreSQL data still needs an appropriate redundancy plan, such as software RAID or replication where suitable, and backups stored outside the database server. Replication and disk redundancy are not substitutes for backups. Plan and test restoration separately.
Choosing between the default and a change
For short transactions, keep JIT disabled unless representative testing shows a repeatable reason to change it. For mixed workloads, test the important query groups instead of choosing one global setting based on a single report. For long-running, CPU-bound analytical queries, run the controlled comparison and keep JIT enabled only when the observed result is useful and reproducible.
If JIT does not help, return to the plan. Check whether estimates match actual rows, whether the query is doing more work than necessary, and whether its main constraint is storage or another wait rather than CPU execution. If the test is inconclusive, preserve the known baseline and gather better evidence instead of treating uncertainty as a reason to enable JIT.
The right next step is to test your own representative analytical query, then use those findings to assess database resources. If shared instances leave CPU availability uncertain, storage options constrained, or resource costs difficult to map to a stable workload, compare them with an exclusive AMD bare-metal server from NetAmd. A dedicated server is a more relevant option when you need control over a sustained database environment—but it does not guarantee faster JIT execution, replace query tuning, or remove the need for tested off-server backups. Check the current NetAmd configuration before deciding whether that deployment model fits your measured workload.
Frequently asked questions
Why is JIT disabled by default in PostgreSQL 19?
JIT compilation adds work before a query runs. That work can outweigh any execution savings for short or frequently repeated queries. PostgreSQL 19 therefore avoids enabling JIT by default, while leaving teams free to test it for suitable workloads. The setting is a safer starting point, not a claim that JIT never helps.
Should I enable JIT for analytical queries in PostgreSQL 19?
Test it when a representative analytical query spends substantial time doing CPU-bound expression evaluation. A large table scan alone is not enough evidence. Compare the same query and data with JIT off and on, and keep the setting disabled if compilation costs erase the benefit or results vary between runs.
How can I confirm that a PostgreSQL query actually used JIT?
Run EXPLAIN with ANALYZE in a safe test environment and inspect the execution output for a JIT section. A planned query without execution does not establish that JIT ran. Also record the plan and runtime separately: seeing JIT details confirms use, but does not prove that the query became faster.
Which metrics should I compare after enabling PostgreSQL JIT?
Compare total execution time, plan shape, rows and loops, buffer activity, and the JIT compilation details shown by EXPLAIN ANALYZE. Use the same query, data state, parameters, and test conditions for both settings. Repeat runs and compare the pattern, rather than treating one unusually fast or slow execution as a result.
Validate JIT on Dedicated Hardware
Run repeatable analytical query tests on a NetAmd dedicated physical server with a 32-core, 64-thread processor.
