{"repo":"ClickHouse/pg_stat_ch","free":true,"listed":false,"github":"https://github.com/ClickHouse/pg_stat_ch","clone":"git clone https://github.com/ClickHouse/pg_stat_ch.git","description":null,"language":"Perl","stars":120,"topics":["clickhouse","metrics","monitoring","postgresql","postgresql-extension"],"license":"Apache-2.0","category":"analytics","readme_excerpt":"pg stat ch: PostgreSQL Query Telemetry Exporter to ClickHouse A PostgreSQL extension that captures per-query execution telemetry and exports it to ClickHouse in real-time. Unlike pg stat statements which aggregates statistics in PostgreSQL, pg stat ch exports raw events to ClickHouse where aggregation happens via ClickHouse's powerful analytical engine. Quickstart Run local PostgreSQL + ClickHouse with schema preloaded: Stop: See docker/quickstart/README.md for endpoints and stack details. Table of Contents - Overview - Architecture - Features - Supported Versions - Building from Source - Installation - Recommended PostgreSQL Settings - Configuration - SQL API - Example Queries - Testing - Troubleshooting - License Overview pg stat ch captures detailed telemetry for every query executed in PostgreSQL and exports it to ClickHouse via a single data pipeline: Key design principles: - Zero network I/O on query path - Events are queued in shared memory, not sent synchronously - Raw events, not aggregates - All aggregation (p50/p95/p99, top queries, errors) happens in ClickHouse - Bounded memory - Fixed-size ring buffer with overflow counters; dropped events don't block queries - Minimal overhead - 5μs p99 overhead per captured statement Architecture Data Flow 1. PostgreSQL Hooks capture query start/end with full instrumentation 2. Shared Memory Ring Buffer stores events (MPSC: multi-producer, single-consumer) 3. Background Worker dequeues batches and exports to ClickHouse 4. Click","default_branch":null,"files":null,"tree":[],"storefront":"/r/ClickHouse","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ClickHouse/pg_stat_ch/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}