clickhousedb_fdw
clickhousedb_fdw · ClickHouse foreign data wrapper with SELECT/INSERT support plus aggregate and join pushdown.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100017 | clickhousedb_fdw | clickhousedb_fdw | 1 | FDW | PostgreSQL | C |
PostgreSQL · 11, 12, 13
Usage
Sources:
clickhousedb_fdw exposes ClickHouse tables through PostgreSQL’s foreign-data-wrapper API. It supports remote reads and inserts, with aggregate and join pushdown, but it is not a general read/write compatibility layer: upstream documents no UPDATE or DELETE support.
Core Workflow
Install and configure the ClickHouse ODBC driver on every PostgreSQL host before creating the extension. The server options identify the ClickHouse database, ODBC driver, and endpoint.
Define a foreign table whose columns and types match the remote ClickHouse table, then query or insert through it.
Use verbose plans to see the SQL sent to ClickHouse and confirm that filters, aggregates, or joins were actually pushed down.
Important Objects
clickhousedb_fdw: the foreign-data wrapper installed by the extension.- Server options
dbname,driver, andhost: select the ClickHouse database, ODBC driver library, and endpoint. - Foreign-table option
table_name: maps a PostgreSQL foreign table to its ClickHouse table. - Remote
SELECTandINSERT: the documented DML surface; aggregate and join pushdown are planner optimizations, not guarantees for every query shape.
Operational Notes
The reviewed upstream revision labels the project as under heavy development and says it was tested with PostgreSQL 11–13. Validate the exact PostgreSQL, ClickHouse, ODBC-driver, and type-conversion combination before deployment. Complex joins and some ClickHouse settings are explicitly incomplete. Network, ODBC, and remote execution errors occur inside the PostgreSQL statement, so set appropriate statement timeouts and test failure recovery. Do not assume transaction, constraint, locking, or rollback semantics match local PostgreSQL tables.