pg_clickhouse v0.10 Pushes Correlated Subqueries to ClickHouse, Cutting a TPC-H Query From 32.7 Seconds to 37 Milliseconds
ClickHouse's pg_clickhouse extension now pushes whole correlated subqueries down to ClickHouse, taking TPC-H pushdown coverage from 12 to 16 of 22 queries.
Overview
ClickHouse has released version 0.10.0 of pg_clickhouse, the PostgreSQL extension that lets a Postgres database offload analytic queries to a connected ClickHouse server, adding support for pushing whole correlated subqueries down to ClickHouse instead of evaluating them locally row by row. According to ClickHouse’s official blog, the change took one TPC-H benchmark query, Q17, from 32.7 seconds to 37 milliseconds, which the post calls “three orders of magnitude difference.” The release was published on GitHub as v0.10.0 on August 11, 2026.
pg_clickhouse underpins “Postgres managed by ClickHouse,” the transactional Postgres service ClickHouse previously reported moved into public beta in June 2026, which pairs a Postgres front end with native change-data-capture into ClickHouse for analytics.
What We Know
- With v0.10.0, pg_clickhouse’s score on the TPC-H benchmark suite moved from 12 of 22 queries fully pushed down to ClickHouse to 16 of 22, according to ClickHouse, which said the change leaves “only 6 to go to finish off the set.”
- The three newly pushed-down queries were previously slow because, in the company’s words, “due to the shape of the query, pg_clickhouse had to fetch every row from ClickHouse individually and then evaluate the subquery on it locally,” according to ClickHouse.
- ClickHouse published a before/after table for the three queries: Q2 went from 3,446 milliseconds under pg_clickhouse 0.3 to 24 milliseconds under 0.10; Q17 went from 32,709 milliseconds to 37 milliseconds; and Q22 went from 1,415 milliseconds to 45 milliseconds, according to ClickHouse.
- ClickHouse singled out Q17, a correlated subquery averaging the
l_quantitycolumn per part, as the standout result: “back when it evaluated once per outer row against 6M line items at scale factor 1, took 32.7 seconds. Fully pushed down, it’s 37 milliseconds,” and the company said the pushed-down version now “outperforms native PostgreSQL’s own plan for the same query (2.1s),” according to ClickHouse. - Six TPC-H queries remain unpushed in v0.10.0: Q13, Q15, Q16, Q18, Q20, and Q21, according to ClickHouse.
- The new subquery pushdown builds on a December 2025 milestone in which pg_clickhouse’s planner learned to push a correlated
EXISTSsubquery down as a singleLEFT SEMI JOIN, which ClickHouse said “moved the needle from 3 of 22 TPC-H queries all the way to 12,” according to ClickHouse. - The correlated-subquery pushdown requires ClickHouse server version 25.8 or later; ClickHouse said the extension “checks the server version at plan time and falls back to local evaluation on older servers” when that requirement isn’t met, according to ClickHouse.
- Because PostgreSQL uses three-valued (NULL-aware) logic for
IN/NOT INcomparisons while ClickHouse’sINuses two-valued logic, ClickHouse said naive pushdown of these operators “can silently invert results,” and v0.10.0 adds guard logic to preserve Postgres semantics before extending unconditional pushdown to the widerIN,NOT IN,= ANY,= ALL,<> ANY, and<> ALLoperator family, according to ClickHouse. - The release also adds two new SQL-callable functions,
clickhouse_query(server, sql)for running arbitrary queries against a configured ClickHouse server andclickhouse_perform(server, sql)for running statements “for effect rather than for rows,” while deprecating the olderclickhouse_raw_query()function, according to ClickHouse. - GitHub’s release page for v0.10.0 lists “Subquery pushdown for scalar aggregates, EXISTS, and IN/NOT IN operations” among the release’s improvements, corroborating the ClickHouse blog’s description of the update.
What We Don’t Know
ClickHouse’s post does not give a timeline for pushing down the six remaining TPC-H queries (Q13, Q15, Q16, Q18, Q20, Q21) or for the broader roadmap items it lists as still open, including lightweight DELETE/UPDATE pushdown and UNION pushdown, according to ClickHouse.
Analysis
The TPC-H suite is a standard analytics benchmark, and pg_clickhouse’s stated goal, according to ClickHouse, is full pushdown across all 22 of its queries. The subquery work in v0.10.0 is presented as the fifth item on a roadmap the company has been working through since a December 2025 update that took the pushdown count from 3 to 12 of 22 queries; the newest release adds 4 more. For developers running Postgres alongside ClickHouse for analytics, the practical effect is that a query written as ordinary correlated-subquery SQL in Postgres can now be planned as a single remote statement executed on ClickHouse, rather than looping back to ClickHouse once per row of the outer query — the pattern ClickHouse says made queries like Q17 slow in earlier versions of the extension.