Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

generating-clickhouse-query-performance-reports

БесплатноБез исполняемых скриптовНе проверен

Produce and structure slow-query performance reports for PostHog's production ClickHouse (US and EU). Use when asked for a slow query report, query…

PostHogот PostHog★ 41 278 звёзд на GitHub

Об этом скилле

Generating ClickHouse query performance reports

This skill is the methodology for investigating slow ClickHouse queries and writing up a performance report. It pairs with querying-production-databases, which is the mechanism (the PostHog MCP's direct-query connections, with sendRawQuery). Run every query in this skill through that one. Use querying-production-databases-via-metabase only for the shareable Metabase links in a report.

Reports themselves are not public. When it exists, the private PostHog/query-performance-analysis repo holds the historical reports and example query IDs; this repo holds only the tooling and methodology. That repo is usually checked out as a sibling folder to the posthog checkout (e.g. ../query-performance-analysis relative to the repo root, or alongside it under the same parent directory). Look for a sibling directory named query-performance-analysis containing an analysis/ folder of dated reports. If you find it, add the new report there as a new markdown file under analysis/, named <YYYY-MM-DD>-<topic>.md (match the existing naming, e.g. 2026-05-27-slow-queries-14d.md).

The sibling repo may not exist, and that is fine. If you cannot find it, do not write into the public posthog repo and do not block on it: write the report to a temp folder instead (e.g. /tmp/<YYYY-MM-DD>-<topic>.md), tell the user where you put it, and skip the previous-report comparison in step 9 (there is no history to diff against).

Data source: posthog.query_log_archive (not system.query_log)

system.query_log on the production clusters retains only a few hours, so it cannot answer a multi-day question. Use the Distributed archive table instead:

FROM posthog.query_log_archive

It exposes log_comment as typed columns, so you skip JSONExtract. A key with no typed column is in the log_comment column, which expires after one month. Query it directly (it already fans out across the cluster). Always filter is_initial_query so distributed sub-queries are not double-counted. Confirm current retention with a per-day count() before trusting a window (see references/query-patterns.md).

Key columns (full list via system.columns WHERE table='query_log_archive'):

Column Meaning
team_id (Int64) Tenant. 0 / empty means internal or unattributed.
lc_kind How the query was issued: request (sync API/web), celery (async refresh), temporal, cohort_calculation, dagster.
lc_product product_analytics, warehouse, experiments, messaging, web_analytics, replay, llm_analytics, cohorts, ...
lc_access_method personal_api_key, oauth, sharing_token, or empty (logged-in web).
lc_query__kind Product query type: TrendsQuery, FunnelsQuery, RetentionQuery, HogQLQuery, ...
lc_workload Workload.OFFLINE / ONLINE.
lc_feature, lc_temporal__workflow_type, lc_route_id, lc_api_key_label Origin detail for attribution.
lc_dashboard_id, lc_insight_id, lc_experiment_id, lc_cohort_id Link a query back to the object that triggered it.
query, query_duration_ms, read_bytes, read_rows, memory_usage, exception_code The query and its cost.

Both regions have the archive. US and EU are separate clusters with different workloads and materialized columns; run cross-region comparisons against both. Discover the current ClickHouse database id per region

Полный SKILL.md на GitHub

Установить generating-clickhouse-query-performance-reports в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/hogql-deep-dive.mdreferences/materialization-analysis.mdreferences/query-patterns.md

FAQ

Что делает скилл generating-clickhouse-query-performance-reports?

Produce and structure slow-query performance reports for PostHog's production ClickHouse (US and EU). Use when asked for a slow query report, query performance analysis over the last N days, per-team query cost, OOM or timeout investigation, cluster cost/memory regressions, or materialization candidates. Covers the modern `query_log_archive` source (typed `lc_*` columns, multi-day retention), how to categorize and attribute slow queries, root-cause patterns (unmaterialized JSONExtract, high-cardinality breakdowns, heavy joins), and the report structure. Runs queries via the `querying-production-databases` skill.

Как установить скилл generating-clickhouse-query-performance-reports?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл generating-clickhouse-query-performance-reports запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить generating-clickhouse-query-performance-reports с