HeadlinesBriefing favicon HeadlinesBriefing.com

pg_clickhouse v0.10.0: Subqueries, TPC-H Speedups, C Driver

Hacker News •
×

Continuing investment in pg_clickhouse, improving pushdown coverage for analytic workloads remains the top focus. With v0.10.0, the TPC-H scoreboard moved from 12 of 22 queries fully pushed down to 16, leaving only 6 to go. The binary driver was rebuilt on a new plain-C client library, and the surface area of functions and aggregates that push down more than doubled.

Three more TPC-H queries now fully push down, all previously inefficient due to fetching every row individually. Q17, a correlated subquery averaging l_quantity per part, dropped from 32.7 seconds to 37 ms—three orders of magnitude faster, outperforming native PostgreSQL's own plan (2.1s).

Six queries remain; the blocker is that PostgreSQL flattens subqueries into anti/semi-joins whose inputs are themselves joins, and the deparser doesn't yet walk a join tree on both sides. December's feature pushed whole correlated EXISTS subqueries as LEFT SEMI JOINs, moving the needle from 3 to 12 queries. Now subqueries in Postgres become subqueries in ClickHouse, enabling full pushdown of TPC-H Q2 and similar.

NULL handling required careful guards because ClickHouse uses two-valued logic while PostgreSQL uses three-valued. v0.10 tracks how each expression's result is consumed to keep results consistent. Additionally, the list of individual functions, operators, and aggregates that push down grew substantially, including statistical aggregates and ordered-set aggregates mapped to ClickHouse's parametric forms.