Documentation Index
Fetch the complete documentation index at: https://pg-stat-ch.clickhouse.com/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- PostgreSQL 16, 17, or 18
- Docker and Docker Compose (for the quickstart and ClickHouse setup)
- ClickHouse (for the default export backend) or an OpenTelemetry collector
Install from prebuilt binaries
Prebuilt binaries are published for every release on Linux (amd64 and arm64) for PostgreSQL 16, 17, and 18.Download the tarball
Go to the latest release and download the tarball matching your PostgreSQL version and architecture. For example, for PostgreSQL 18 on amd64:Available variants:
| PostgreSQL | amd64 | arm64 |
|---|---|---|
| 16 | pg_stat_ch-*-pg16-linux-amd64.tar.gz | pg_stat_ch-*-pg16-linux-arm64.tar.gz |
| 17 | pg_stat_ch-*-pg17-linux-amd64.tar.gz | pg_stat_ch-*-pg17-linux-arm64.tar.gz |
| 18 | pg_stat_ch-*-pg18-linux-amd64.tar.gz | pg_stat_ch-*-pg18-linux-arm64.tar.gz |
INSTALL.md in the tarball for full instructions.
Build from source
Building from source requires CMake 3.20+, Ninja (or Make), a C++17 compiler (GCC 10+, Clang 13+), and PostgreSQL development headers (postgresql-server-dev-*).
Clone the repository with submodules:
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, connect it to a backend to start receiving events:Quick start
Docker-based setup that gets you from zero to querying events in ClickHouse
ClickHouse setup
Production ClickHouse deployment, schema, and data retention
OpenTelemetry export
Route telemetry through your existing OTel collector to Grafana, Datadog, etc.
Configuration
Tune queue size, flush interval, and connection settings

