---
title: "Introducing Postgres Query Insights in ClickHouse Cloud"
description: "ClickHouse Cloud introduced Query Insights in preview for Managed Postgres to help teams diagnose slow database queries. Powered by the open-source extension pg_stat_ch, the tool streams per-statement telemetry directly into ClickHouse to enable fast aggregations across billions of execution rows. Postgres normalizes query literals into placeholders during the parse-analyze phase before telemetry leaves the database, preventing sensitive data exposure. Telemetry emission maintains around three percent producer overhead by utilizing a non-blocking try-lock on a shared-memory ring buffer. Users can examine high-level database health metrics, rank query patterns by runtime or latency percentiles, and inspect execution flyouts detailing disk spills, cache hits, and parallel worker behavior."
---

# Introducing Postgres Query Insights in ClickHouse Cloud

[Clickhouse](https://yomu.fyi/company/clickhouse) · Amog Iska · May 7, 2026

**Type:** Announcement

## Summary

ClickHouse Cloud introduced Query Insights in preview for Managed Postgres to help teams diagnose slow database queries. Powered by the open-source extension pg\_stat\_ch, the tool streams per-statement telemetry directly into ClickHouse to enable fast aggregations across billions of execution rows. Postgres normalizes query literals into placeholders during the parse-analyze phase before telemetry leaves the database, preventing sensitive data exposure. Telemetry emission maintains around three percent producer overhead by utilizing a non-blocking try-lock on a shared-memory ring buffer. Users can examine high-level database health metrics, rank query patterns by runtime or latency percentiles, and inspect execution flyouts detailing disk spills, cache hits, and parallel worker behavior.

## Context

Diagnosing slow database queries often requires inspecting multiple metrics across scattered tools, and identifying tail-latency regressions or costly query patterns without adding database overhead or exposing sensitive query parameters is difficult.

## Approach / What changed

ClickHouse introduced Postgres Query Insights and pg\_stat\_ch, an Apache 2.0 extension that captures per-statement telemetry and streams raw events into ClickHouse Cloud. The extension normalizes literals during Postgres parse-analyze into placeholders and uses a non-blocking try-lock on a shared-memory ring buffer (~3% overhead) that drops events rather than blocking under pressure. The UI aggregates raw events to provide database health overviews, sorted query pattern tables, and execution flyouts showing CPU time, cache hits, temp block operations, and parallel worker counts.

## Takeaways

- The pg\_stat\_ch extension normalizes query literals into placeholders during the parse-analyze phase and caches them in a per-backend LRU by queryid, preventing PII and PHI from leaving the database.
- To maintain about 3% overhead, pg\_stat\_ch uses a non-blocking try-lock on a shared-memory ring buffer, queues locally to flush at transaction end if contended, and drops events under pressure rather than blocking.
- ClickHouse Cloud stores raw per-statement telemetry rather than pre-computed aggregates, relying on columnar compression and fast query execution to dynamically compute percentiles, rankings, and filters.

**Tags:** [Monitoring](https://yomu.fyi/topic/monitoring), [Observability](https://yomu.fyi/topic/observability), [Open Source](https://yomu.fyi/topic/open-source), [Performance](https://yomu.fyi/topic/performance), [Postgres](https://yomu.fyi/topic/postgres)

- Source: [Clickhouse](https://clickhouse.com/blog/postgres-query-insights-clickhouse-cloud)
- Source URL: https://clickhouse.com/blog/postgres-query-insights-clickhouse-cloud
- Ingested by Yomu: 2026-08-28T01:25:33.969Z

[Read original post](https://clickhouse.com/blog/postgres-query-insights-clickhouse-cloud)
