pg_clickhouse
pg_clickhouse
pg_clickhouse : Interfaces to query ClickHouse databases from PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 2460 | pg_clickhouse | pg_clickhouse | 0.1.5 | OLAP | Apache-2.0 | C++ |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--sLd-r | No | Yes | Yes | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | pg_duckdb duckdb_fdw citus columnar citus_columnar clickhouse_fdw postgres_fdw dblink |
with submodule
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.1.5 | 18 17 16 15 14 | pg_clickhouse | - |
| RPM | PIGSTY | 0.1.5 | 18 17 16 15 14 | pg_clickhouse_$v | - |
| DEB | PIGSTY | 0.1.5 | 18 17 16 15 14 | postgresql-$v-clickhouse | - |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 |
el8.aarch64 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 |
el9.x86_64 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 |
el9.aarch64 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 |
el10.x86_64 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 |
el10.aarch64 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 |
d12.x86_64 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 |
d12.aarch64 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 |
d13.x86_64 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 |
d13.aarch64 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 |
u22.x86_64 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 |
u22.aarch64 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 |
u24.x86_64 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 |
u24.aarch64 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 | PIGSTY 0.1.5 |
Source
pig build pkg pg_clickhouse; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install pg_clickhouse; # install via package name, for the active PG version
pig install pg_clickhouse -v 18; # install for PG 18
pig install pg_clickhouse -v 17; # install for PG 17
pig install pg_clickhouse -v 16; # install for PG 16
pig install pg_clickhouse -v 15; # install for PG 15
pig install pg_clickhouse -v 14; # install for PG 14Config this extension to shared_preload_libraries:
shared_preload_libraries = 'pg_clickhouse';Create this extension with:
CREATE EXTENSION pg_clickhouse;Usage
pg_clickhouse enables analytics queries on ClickHouse directly from PostgreSQL without SQL rewriting.
It supports PostgreSQL 13+ and ClickHouse v23+.
Create the Extension
CREATE EXTENSION pg_clickhouse;Or into a specific schema:
CREATE SCHEMA env;
CREATE EXTENSION pg_clickhouse SCHEMA env;Query Pushdown
The extension automatically pushes down analytical queries to ClickHouse for execution, providing significant performance improvements. For example, TPC-H benchmarks show:
- Query 1: 268ms (vs 4,693ms on standard PostgreSQL)
- Query 6: 53ms (vs 764ms on standard PostgreSQL)
When query pushdown is active, ClickHouse handles execution directly, avoiding data transfer overhead for complex analytical workloads.
Last updated on