In December 2025, we launched pg_clickhouse, a PostgreSQL extension to query ClickHouse directly from Postgres. Its primary goal is to minimize the application migration effort required to move analytics workloads from Postgres to ClickHouse. In designing pg_clickhouse, we made deliberate architectural choices to ensure that you can continue to use the familiar Postgres interface for both transactional and analytical queries, while harnessing the full power of ClickHouse for analytics.
In this blog post, we examine those design choices and highlight their performance impact by benchmarking pg_clickhouse in ClickBench.
Query pushdown vs. shoehorning analytics into Postgres #
We designed pg_clickhouse to minimize load on Postgres by offloading analytic execution as much as possible to ClickHouse. Instead of running heavy analytics inside Postgres and consuming its resources, it rewrites queries for execution in ClickHouse and only the results are returned, on a best-effort basis.
This architecture contrasts with most analytic extensions that embed columnar storage and analytic execution engines directly within Postgres. While those approaches can accelerate analytics, they still rely on Postgres resources and are ultimately constrained by a single shared node. As data volumes grow into the terabyte or tens-of-terabytes range, analytics workloads begin to compete with transactional workloads for the same system resources.
By delegating execution to ClickHouse, pg_clickhouse enables independent scaling and avoids resource contention within Postgres. This model especially enhances aggregation-heavy queries that scan millions or billions of rows. In this context, effective query pushdown is the central challenge, not just for filtering, but for aggregation in particular.
pg_clickhouse is the fastest Postgres extension on ClickBench #
To evaluate the impact of these design choices, we recently added pg_clickhouse to ClickBench, a standard benchmark for analytical DBMS.
As of the end of January, the results are in: pg_clickhouse is the fastest PostgreSQL extension, outperforming all other Postgres analytics extensions, performing only slightly slower than native ClickHouse itself. Across all 42 ClickBench queries, on both ARM64 (c8g) and AMD64 (c6a) instances, performance closely tracks ClickHouse.
These results confirm that pg_clickhouse pushes down full query execution to ClickHouse. The only measurable overhead comes from rewriting queries, the network round-trip, and converting the results to Postgres. Postgres does not execute the analytical workload itself; it acts purely as a routing and result layer.
ClickBench relies a relatively simple schema: a single denormalized table with no JOINs. While this avoids join pushdown complexity, it highlights something equally important: comprehensive aggregate and expression pushdown.
The benchmark exercises a broad range of operations that pg_clickhouse fully entrusts to ClickHouse, including:
COUNT(), SUM(), AVG(), COUNT(DISTINCT)
MIN(), MAX()
GROUP BY
ORDER BY (including ORDER BY COUNT())
HAVING
EXTRACT(), DATE_TRUNC
Date comparisons
LIKE, REGEXP_REPLACE()
CASE WHEN
These represent only a subset of the aggregates, functions, and expressions currently supported. We continue to expand coverage, document supported patterns, and close remaining gaps, most recently in yesterday's 0.1.4 release.
And we're not stopping here. Work is already underway to support more complex query shapes, including subqueries and CTEs. We'll share more on these improvements in the coming months.
ClickHouse + Postgres has become the unified data stack for applications that scale. With Managed Postgres now available in ClickHouse Cloud, this stack is a day-1 decision.
Share this post
Subscribe to our newsletter
Stay informed on feature releases, product roadmap, support, and cloud offerings!