Skip to main content

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.
1

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:
2

Extract and install

See INSTALL.md in the tarball for full instructions.
Debug symbol packages (*-debuginfo.tar.gz) are also available for crash analysis. Extract and point gdb at the debug directory.

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:
If you have mise installed:
Other build targets:

Using CMake directly

To target a specific PostgreSQL installation, pass -DPG_CONFIG:

Load the extension

pg_stat_ch must be loaded via shared_preload_libraries because it needs to initialize at server startup.
1

Edit postgresql.conf

If you already have other extensions loaded, add pg_stat_ch to the comma-separated list:
2

Restart PostgreSQL

3

Create the extension in each database you want to monitor

Verify installation

Check that the extension is loaded and the background worker is running:
If the background worker doesn’t appear, check the PostgreSQL log for errors. The most common issue is forgetting to add pg_stat_ch to shared_preload_libraries. 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