Prerequisites
- PostgreSQL 16, 17, or 18 with development headers (
postgresql-server-dev-*or built from source) - CMake 3.20+ and Ninja (or Make)
- A C++17 compiler (GCC 10+, Clang 13+)
- Docker and Docker Compose (for the quickstart and ClickHouse setup)
- ClickHouse (for the default export backend) or an OpenTelemetry collector
Build from source
Clone the repository with submodules (the ClickHouse C++ client is vendored):Using mise (recommended for development)
If you have mise installed:Using CMake directly
-DPG_CONFIG:
Load the extension
pg_stat_ch must be loaded viashared_preload_libraries because it needs to initialize at server startup.
Edit postgresql.conf
Verify installation
Check that the extension is loaded and the background worker is running:shared_preload_libraries.
Recommended PostgreSQL settings
These PostgreSQL settings are not required but provide more data:Next steps
With the extension loaded, set up the ClickHouse backend to start receiving events:Quick start
Docker-based setup that gets you from zero to querying events

