6 min read
|
Saved February 14, 2026
|
Copied!
Do you care about this?
The article introduces pg_clickhouse, a PostgreSQL extension that allows users to run analytics queries on ClickHouse without modifying their existing PostgreSQL queries. It aims to streamline the migration process for organizations moving from PostgreSQL to ClickHouse, addressing challenges like query rewriting and execution speed.
If you do, here's more
Over the past year, many organizations have shifted their analytics workloads to ClickHouse Cloud, with PostgreSQL being the primary source of migration. While ClickPipes has streamlined data replication, users still encounter difficulties migrating their SQL queries and application code from PostgreSQL to ClickHouse. To tackle this, the pg_clickhouse v0.1.0 extension has been developed, allowing users to execute analytics queries on ClickHouse directly from PostgreSQL without modification to existing queries.
Pg_clickhouse aims to simplify the transition by allowing PostgreSQL queries to run as if they were accessing standard Postgres tables. This involves pushing query execution to ClickHouse while maintaining the integrity of existing SQL queries. The extension builds on the concept of foreign data wrappers (FDWs) that PostgreSQL has supported since version 9.3. While existing solutions like clickhouse_fdw laid the groundwork, they lacked recent enhancements and broader support. Pg_clickhouse modernizes these foundations, adding support for complex query pushdowns, including advanced aggregations and JOINs.
Key features of pg_clickhouse include TLS support for secure connections, compatibility with PostgreSQL versions 13 to 18, and the ability to translate complex PostgreSQL aggregate functions into their ClickHouse equivalents. For example, it translates `percentile_cont` into ClickHouse's `quantile` function, ensuring efficient execution without requiring users to rewrite their queries. This approach significantly reduces the burden on developers, allowing for a smoother transition to an analytics-focused database while leveraging the existing SQL infrastructure.
Questions about this article
No questions yet.