Lab database benchmark · PostgreSQL
What changes for speed when you upgrade PostgreSQL 18.7 to 19.0, and does turning JIT back on help large analytical queries?
- Release notes: "If you run many large analytical queries, you may want to enable JIT." - confirmed on our machine
- Filtered count over 10M rows: 19.0 is 16.4% faster than 18.7
- Expression-heavy aggregate over 10M rows: 19.0 is 31.6% slower than 18.7
- Filtered count over 10M rows, JIT on against the default: 19.0 JIT on is 16.7% slower than 19.0
- Expression-heavy aggregate over 10M rows, JIT on against the default: 19.0 JIT on is 20.7% faster than 19.0
If you run many large analytical queries, you may want to enable JIT.
(release notes): confirmed in our test
Measured Nov 22, 2026 on our own machine. How we tested · Raw data
On this page · 3 sections
TL;DR
In our test, the expression-heavy aggregate over 10M rows ran 31.6% slower on PostgreSQL 19.0 than on 18.7, at 923 ms on 19.0 against 701 ms on 18.7. With JIT turned back on, 19.0 ran it at 732 ms, and our test showed no clear difference from 18.7. The same upgrade made a filtered count over 10M rows 16.4% faster.
Expression-heavy aggregates were slower on 19.0 #
In our test, the expression-heavy aggregate over 10M rows took 701 ms (spread ±5.7%) on 18.7 and 923 ms (spread ±4.0%) on 19.0, which is 31.6% slower on 19.0. The measure is lower-is-better, so this query was the one slower case in the upgrade comparison.
Filtered counts were 16.4% faster #
In our test, a filtered count over 10M rows took 201 ms (spread ±4.7%) on 18.7 and 168 ms (spread ±5.4%) on 19.0, which is 16.4% faster on 19.0. The PostgreSQL 19 release announcement says the release "makes many workloads faster without changes to your application". In our test, the same upgrade gave opposite verdicts for two query shapes on the same table.
Five of seven comparisons showed no clear difference #
In our test, five of the seven comparisons between 18.7 and 19.0 showed no clear difference. These are the load, pgbench and sort-and-group paths:
- Load 1M pgbench rows: 625 ms (spread ±9.7%) on 18.7 and 628 ms (spread ±7.6%) on 19.0.
- pgbench read-only, 8 clients, 40,000 transactions: 696 ms (spread ±3.9%) on 18.7 and 692 ms (spread ±1.6%) on 19.0.
- pgbench read-write, 8 clients, 8,000 transactions: 908 ms (spread ±3.9%) on 18.7 and 908 ms (spread ±4.0%) on 19.0.
- GROUP BY over 10M rows: 394 ms (spread ±5.5%) on 18.7 and 393 ms (spread ±2.5%) on 19.0.
- Top 100 by sort over 10M rows: 303 ms (spread ±4.0%) on 18.7 and 276 ms (spread ±8.2%) on 19.0.
Turning JIT back on helped the aggregate and slowed the filtered count #
The PostgreSQL 19 release announcement says: "If you run many large analytical queries, you may want to enable JIT." In our test, JIT on in 19.0 brought the expression-heavy aggregate to 732 ms (spread ±3.8%), against 923 ms (spread ±4.0%) on the default 19.0, which is 20.7% faster. The same setting took the filtered count to 196 ms (spread ±4.8%), against 168 ms (spread ±5.4%) on the default, which is 16.7% slower.
Against 18.7, the JIT-on 19.0 aggregate showed no clear difference, at 701 ms (spread ±5.7%) on 18.7 and 732 ms (spread ±3.8%) on 19.0 JIT on. GROUP BY and top-100 sort queries also showed no clear difference with JIT on. So in our test, JIT on helped the expression-heavy aggregate, the query we checked the announcement's advice against, and slowed the short filtered count; it did not help every analytical query.
Why JIT is off by default #
Note
Background: The PostgreSQL 19 release notes state: "Previously JIT was enabled by default, and activated based on optimizer costs, but this costing has been determined to be unreliable." The same notes list the change to disable JIT by default among the incompatibilities for migrating to version 19.
Our test ran 18.7 with JIT on and 19.0 with JIT off, which matches that default change. The release notes explain why the default changed; our test adds what it cost one query shape on our machine: 31.6% on the expression-heavy aggregate.
The Sentinel’s Call
If your workload runs expression-heavy aggregates over large tables, check that query shape first: our test measured it 31.6% slower on 19.0 than on 18.7. Turning JIT back on brought it to 732 ms, which our test could not tell apart from 18.7's 701 ms, but it made the filtered count 16.7% slower, so it is not a blanket setting for analytical work. Load, pgbench, GROUP BY and top-100 sort showed no clear difference in our test.
Our judgement, drawn only from the facts and sources above.
How we tested
Machine: AMD Ryzen 7 7800X3D (8 cores, 16 threads) · 32 GB RAM · Windows 11 Pro, Docker Desktop (WSL 2) · Docker Engine 29.9.3
- 18.7
postgres:18.7sha256:9f4fd4aa918f… - 19.0
postgres:19.0sha256:bb6e70add742… - 19.0 JIT on
postgres:19.0sha256:bb6e70add742…
- Median of 11 rounds after 1 warm-up round; the version that starts each round rotates
- 8 CPU cores and a 6 GB memory limit per container, data in memory (tmpfs), default server settings
- JIT as each version runs it: on on 18.7, off on 19.0, on on 19.0 JIT on
- pgbench scale 10 (1M rows) reloaded every round; a 10M-row analytical table built once per container
Self-test: 18.7 against 18.7 in two containers: the largest difference was 1.7%, none of them clear.
Reproduce it
cat postgres-lab.sh | docker run --rm -i --network none --read-only --cpus 8 --memory 6g --user 10001:10001 --tmpfs /tmp:exec --tmpfs /home/check:exec,size=4g,uid=10001 -e HOME=/home/check -w /home/check postgres:19.0 sh -s
Add -e JIT=on for 19.0 with JIT on; use postgres:18.7 for 18.7.
The script: https://thestacksentinel.com/lab/scripts/postgres-lab.sh.txt (save it as postgres-lab.sh)Limits
- One machine: an 8-core desktop CPU under Windows 11 and WSL 2; a Linux server may behave differently.
- The data lives in memory, so disk speed is not part of these numbers.
- Default server settings; a tuned server (memory, parallel workers, JIT costs) may differ.
Sources
- PostgreSQL: PostgreSQL 19 Released! postgresql.org · Nov 19, 2026
- PostgreSQL: Documentation: 19: E.1. Release 19 postgresql.org · Nov 19, 2026
Edited and approved by Jarosław Krzemiński. Spotted a mistake? Report a correction or read the corrections policy.




Comments