Skip to main content

Build

Clickhouse Managed Postgres Rca

ClickHouseOfficialCertified

MUST USE when investigating performance issues on a ClickHouse-managed Postgres instance. Provides an evidence-based RCA workflow that scrapes the Prometheus endpoint for system signal, pulls per-digest evidence from the Slow Query Patterns API, and recommends (does not apply) a fix.

  • 1 install
  • v1.0.1
  • Reviewed Jul 21
  • No reviews yet

Capabilities

  • What you have access to

    Two APIs on https://api.clickhouse.cloud (HTTP Basic auth

  • What you do NOT have

    Reason from IO and timing signals, not from a plan tree

  • Discover the live API shape

    These endpoints are Beta — paths, params, and JSON field names

  • Scrape Prom once for system gauges

    Follow rules/prometheus-scrape.md

Getting started

Full instructions

Install the skill, then ask your AI tool for the task in plain words. The full SKILL.md below shows what it covers.

Instructions: SKILL.mdv1.0.1

ClickHouse Managed Postgres RCA

When to use

Trigger whenever a user reports slowness, high CPU, low
throughput, cache thrash, or any unexplained pain on a
ClickHouse-managed Postgres instance.

What you have access to

Two APIs on https://api.clickhouse.cloud (HTTP Basic auth
using a ClickHouse Cloud API key/secret pair):

  • Prometheus metrics — operation postgresInstancePrometheusGet
    under the Prometheus tag. Returns Prometheus exposition format.
    System and workload metrics for one Postgres service.
  • Slow Query Patterns — operation slowQueryPatternsGetList
    under the Postgres tag. Returns per-digest latency, IO, and
    call statistics for normalized query patterns. Beta.

Both endpoints require an organizationId and a serviceId as
path parameters. The user must supply both, plus the API
key/secret pair.

What you do NOT have

  • Query plans / EXPLAIN output.
  • Per-table scan-type counters (seq_scan / idx_scan).
  • Autovacuum or last-ANALYZE timestamps.

Reason from IO and timing signals, not from a plan tree.

Workflow

Six steps, in order. Do not skip ahead.

Steps 2 and 3 only share auth — no data dependency between
them. Run them in parallel (background curls, & + wait) to
cut wall time from sequential ~2s to ~1s.

1. Discover the live API shape

These endpoints are Beta — paths, params, and JSON field names
can shift. Follow rules/openapi-discovery.md to:

  1. Fetch the OpenAPI spec from https://api.clickhouse.cloud/v1.
  2. Locate the two operations by operationId:
    • postgresInstancePrometheusGet (Prometheus tag)
    • slowQueryPatternsGetList (Postgres tag)
  3. Resolve their path templates, required query parameters,
    and (for the slow-query endpoint) the response schema.
  4. Build a session-scoped role map from the schema property
    descriptions: { semantic role → actual field name }.

Use the resolved names in every subsequent request and citation.
Never hardcode field names from memory.

2. Scrape Prom once for system gauges

Follow rules/prometheus-scrape.md. One scrape, no wait.
You're after gauges (current values) that don't need a delta:
CacheHitRatio, ActiveConnections, MemoryUsedPercent,
FilesystemUsedPercent.

A CacheHitRatio well below ~95% on a workload that should
fit in cache is a real signal on its own. Climbing
ActiveConnections toward the pool ceiling is a real signal
on its own. These don't need rate-of-change.

A second scrape for counter deltas is opt-in, used only
when Step 4 triage points at write-congestion (where deadlock
and rollback rates matter and the Slow Query Patterns API
can't substitute). For the read-path case (the most common
RCA shape) the single scrape is enough.

3. Pull top slow query patterns

Request the slow query patterns. Follow
rules/slow-query-patterns-fields.md for the fields that
matter and how to read them. This is the primary diagnostic —
it returns per-pattern accumulated totals (call count, runtime,
blocks, rows) over the window you request, which is the
"rate-of-change" data you'd otherwise derive from two Prom
scrapes — but per query and without waiting.

If no patterns return a meaningful totalDurationUs, the
report may be overstated or the issue isn't query-shaped.
Stop and tell the user what you looked at.

4. Triage: pick the right heuristic

Follow rules/triage.md. Match the combined Prom + slow-query
signal to one of the heuristic shapes. Each shape points to a
specific heuristic file:

  • rules/heuristic-full-scan.md — read-path full scan.
  • rules/heuristic-hot-loop.md — N+1 / hot loop from the app.
  • rules/heuristic-write-congestion.md — deadlocks, slow
    writes, high rollback rate.

If the signal does not match any shape cleanly, do not invent
a hypothesis. Surface the top patterns and ask the user which
workload they recognize. New heuristics are welcome as PRs.

5. Reason, then recommend

Use the format in rules/output-template.md. Always include:
symptom, evidence, hypothesis (noting any alternative cause
you cannot rule out from this surface alone), short-term fix,
and long-term follow-ups.

6. Do not apply the fix

Follow rules/recommend-only.md. Never run DDL. Never call
pg_cancel_backend or pg_terminate_backend. Write the
recommendation, explain why, and let the human apply it.

Full Compiled Document

For the complete guide with every rule expanded in a single
context load: AGENTS.md.

Explore more skills

Browse all
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

More from ClickHouse

View source →
clickhouse-best-practicesMUST USE when reviewing ClickHouse schemas, queries, native full-text search, or configurations. Contains 36 rules that MUST be checked before providing recommendations. Always read relevant rule files and cite specific rules in responses.2 installschdb-datastoreUse when the user has tabular data (pandas DataFrame, parquet, csv, Arrow, json) and wants to filter, group, aggregate, join, or speed up slow pandas. Provides chDB DataStore — same pandas API, ClickHouse engine underneath. Also handles…1 installsclickstack-otel-collectorUse when a user wants to wire an OpenTelemetry collector into a Managed ClickStack service on ClickHouse Cloud, either by deploying a new local collector (Docker run or Docker Compose) or by configuring their own existing collector, then…0 installsclickhouse-architecture-advisorMUST USE when designing ClickHouse architectures, selecting between ingestion or modeling patterns, or translating best practices into workload-specific system designs. Complements clickhouse-best-practices with decision frameworks and…0 installsclickhouse-js-node-codingWrite idiomatic application code with the ClickHouse Node.js client (`@clickhouse/client`). Use this skill whenever a user is *building* against the Node.js client — configuring the client, pinging, inserting rows in JSON or raw formats,…0 installsclickhouse-js-node-troubleshootingTroubleshoot and resolve common issues with the ClickHouse Node.js client (@clickhouse/client). Use this skill whenever a user reports errors, unexpected behavior, or configuration questions involving the Node.js client specifically —…0 installs

Frequently asked questions about clickhouse-managed-postgres-rca

What does the clickhouse-managed-postgres-rca skill do?

MUST USE when investigating performance issues on a ClickHouse-managed Postgres instance. Provides an evidence-based RCA workflow that scrapes the Prometheus endpoint for system signal, pulls per-digest evidence from the Slow Query Patterns API, and recommends (does not apply) a fix. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the clickhouse-managed-postgres-rca skill?

Run `npx @skills-hub-ai/cli install clickhouse-managed-postgres-rca` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/clickhouse-managed-postgres-rca/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does clickhouse-managed-postgres-rca work with?

clickhouse-managed-postgres-rca runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the clickhouse-managed-postgres-rca skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use clickhouse-managed-postgres-rca after installing it?

In Claude Code, type `/clickhouse-managed-postgres-rca` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the clickhouse-managed-postgres-rca skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.

Badge for your README

Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.

Install on Skills Hub badge preview
Markdown
[![Install on Skills Hub](https://skills-hub.ai/api/badges/skill/clickhouse-managed-postgres-rca)](https://skills-hub.ai/skills/clickhouse-managed-postgres-rca)
HTML
<a href="https://skills-hub.ai/skills/clickhouse-managed-postgres-rca"><img src="https://skills-hub.ai/api/badges/skill/clickhouse-managed-postgres-rca" alt="Install on Skills Hub"></a>

More options in the badge docs.