Skip to content
Tech News
← Back to articles

pg_clickhouse v0.10: Subquery pushdown and 1000x faster TPC-H queries

read original more articles
Why This Matters

The latest release of pg_clickhouse v0.10 significantly enhances query performance by enabling full pushdown for more TPC-H benchmark queries, achieving up to 1000x faster execution times. These improvements demonstrate how optimized pushdown capabilities can drastically reduce query latency, offering substantial benefits for analytic workloads in the tech industry. This progress positions pg_clickhouse as a powerful tool for developers seeking efficient, scalable database solutions.

Key Takeaways

Continuing our investment in pg_clickhouse, improving pushdown coverage for analytic workloads has remained our top focus, with full pushdown across the TPC-H benchmark suite as our immediate metric. We've had a lot of progress since our last update in June, including on the TPC-H scoreboard, which we haven't really talked about since our introductory post back in December, so that's where we'll start. With the release of v0.10.0, our scoreboard has moved from 12 of 22 TPC-H queries fully pushed down to 16, leaving only 6 to go to finish off the set.

Along the way, we also

rebuilt the binary driver on a new plain-C client library,

more than doubled the surface area of functions and aggregates that push down,

hardened the binary driver against a couple of concurrency bugs, detailed below.

The scoreboard #

Three more TPC-H queries now fully push down. All three were exceedingly inefficient before because, 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 (full chart):

Query PostgreSQL pg_clickhouse 0.3 pg_clickhouse 0.10 Pushdown Q2 588 ms 3,446 ms 24 ms ✔ Q17 2107 ms 32,709 ms 37 ms ✔ Q22 270 ms 1,415 ms 45 ms ✼

( ✔ = whole query is a single foreign scan )

( ✼ = pushed down, but as more than one remote query; typically an outer scan plus one InitPlan scan.)

... continue reading