Hello listeners!
Yesterday, with little fanfare (yay 🎉) we pushed out a minor release to pg_clickhouse, the interface for querying ClickHouse from Postgres. As with previous minor releases, yesterday’s v0.3.0 release requires no reload, restart, or ALTER EXTENSION UPDATE, just reload your session when you’re ready and you’re good to go.
But don’t let the minor version increment deceive you: we made a significant change to pg_clickhouse in this version. What change, you ask? Here it is:
We replaced the clickhouse-cpp library powering the binary driver with the new clickhouse-c library written by my colleague Philip Dubé (a.k.a., serprex). This header-only client library provides a number of substantial benefits vs. the clickhouse-cpp library we previously vendored:
- Eliminates incompatibility between C++
raise/throw& RAII and PostgresPG_TRY& setjmp/longjmp. The result is much more stable code paths with susceptibility to crashes. - Allows us to strictly use Postgres memory contexts, rather than having to deal with both Postgres and C++ allocation patterns, thanks to the library’s support for specifying the memory allocation functions to use.
- Eliminates the overhead of vendored code, notably absl and cityhash. It does now require liblz4 and libzstd packages, in addition to the previously-required libcurl, uuid, and libssl, but this pattern makes it far more friendly to packager.
- Far faster compile times and resulting binary. On my M4 MacBook Pro, compiling, installing, and running all the tests now takes around 2 seconds! Meanwhile, the binary size has dropped from 1.8 MB to around 400 KB; on x8664 Linux it went from 4.9 MB to 1.4 MB!
Big change under the hood! Plus a bug fix to properly convert UInt16 values to int32 instead of int16. This is a good one. Get it from the usual suspects:


