system-tables-reference

Reference verified column names and tool mappings for ClickHouse system tables.

255|42|Updated Nov 16, 2023
One-click install
npx skills add https://github.com/chmonitor/chmonitor --skill system-tables-reference
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: system-tables-reference
Source: https://github.com/chmonitor/chmonitor/tree/main/.agents/skills/system-tables-reference
Command: npx skills add https://github.com/chmonitor/chmonitor --skill system-tables-reference

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing raw SQL against ClickHouse system tables frequently causes errors from referencing non-existent (hallucinated) columns, wastes time debugging failed queries, and produces incorrect results when users guess column names or use outdated schema information. It also creates unnecessary work when pre-built, version-aware dedicated tools exist for common monitoring and troubleshooting tasks.

Core Features & Use Cases

  • Verified Column Reference: Provides exact, up-to-date column names for all commonly queried ClickHouse system tables (including processes, query_log, parts, merges, mutations, replicas, replication_queue, disks, settings, zookeeper, users/grants, metrics, and more) to eliminate guesswork and avoid unknown column errors.
  • Tool Mapping Guide: Maps routine monitoring questions (for example, "what queries are running now?" or "what are the slowest finished queries?") to their corresponding pre-built dedicated tools, so users do not have to write or maintain raw SQL for standard operational tasks.
  • Edge Case Rules: Includes critical schema quirks and usage rules, such as the lack of a database column on system.processes (use current_database instead), the required path filter for system.zookeeper, and the need to filter type = 'QueryFinish' on system.query_log to avoid double-counting completed queries.
  • Use Case: A DBA troubleshooting a replication lag issue can use this skill to quickly confirm the correct columns for system.replicas and use the dedicated get_replication_status tool instead of writing a custom raw SQL query that may miss key fields or return incorrect results.

Quick Start

Use the system-tables-reference skill to verify the correct column names for the system.replicas table before writing a query to check for replication lag across your ClickHouse cluster.

Frequently Asked Questions about system-tables-reference

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find the correct column names for ClickHouse system tables when writing SQL?▼

To find correct column names for ClickHouse system tables, use a verified column reference to eliminate guesswork and avoid query errors from non-existent columns. It provides exact, up-to-date schema mappings for commonly queried tables like processes, parts, and merges.

Why does my ClickHouse system.processes SQL query fail when filtering by a database column?▼

Your ClickHouse system.processes query fails because the table lacks a database column. You must use the current_database setting instead. Referencing schema edge cases like this prevents unexpected errors when writing raw SQL for operational monitoring.

How do I avoid double-counting completed queries in ClickHouse system.query_log?▼

To avoid double-counting completed queries in ClickHouse system.query_log, you must filter the results using type = 'QueryFinish'. Applying this specific schema rule ensures your troubleshooting analysis returns accurate metrics.

What is the best way to monitor ClickHouse replication lag without writing raw SQL?▼

The best way to monitor ClickHouse replication lag without raw SQL is using pre-built dedicated tools. A tool mapping guide connects routine operational questions to existing tools, preventing custom queries that may miss key fields or return incorrect results.

Do I need a path filter when querying the ClickHouse system.zookeeper table?▼

Yes, you need a required path filter when querying the ClickHouse system.zookeeper table. Including critical schema quirks and usage rules like this in your queries ensures successful execution and prevents unnecessary debugging time.