---
title: "System Tables and a Window into the Internals of ClickHouse"
description: "ClickHouse system tables are read-only virtual tables in the system database that expose server state, settings, metrics, errors, parts and query history."
url: "https://swe.quest/articles/system-tables-and-a-window-into-the-internals-of-clickhouse-4ad666c7ab1a3be7"
canonical: "https://clickhouse.com/blog/clickhouse-debugging-issues-with-system-tables"
source: "ClickHouse"
published: "2022-12-21"
difficulty: "medium"
kind: "How-to"
reading_minutes: 13
tags: ["analytics","observability","debugging","sql"]
---

# System Tables and a Window into the Internals of ClickHouse

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2022-12-21, 13 min read, How-to. Original: [https://clickhouse.com/blog/clickhouse-debugging-issues-with-system-tables](https://clickhouse.com/blog/clickhouse-debugging-issues-with-system-tables)

## Summary

ClickHouse system tables are read-only virtual tables in the system database that expose server state, settings, metrics, errors, parts and query history. Most live in memory, while log tables such as query\_log, part\_log and metric\_log persist on MergeTree storage. A set of practical diagnostic queries shows how to use them: system.settings for non-default values, query\_log with normalizedQueryHash and ProfileEvents for slow, memory-heavy and failed queries, system.errors for frequent error codes with traces, and part\_log to confirm inserts are producing parts. These queries can serve as a starting toolkit for troubleshooting and understanding cluster usage.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)
- [Debugging](https://swe.quest/tags/debugging.md) (Engineering practices)
- [SQL](https://swe.quest/tags/sql.md) (Languages)

## Prerequisites

- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- ClickHouse MergeTree engine ([easy posts on Analytics & OLAP](https://swe.quest/tags/analytics.md?difficulty=easy))

## Keywords

ClickHouse, system.query\_log, system.part\_log, system.errors, MergeTree

## Related posts

- [Common issues you can solve using advanced monitoring dashboards](https://swe.quest/articles/common-issues-you-can-solve-using-advanced-monitoring-dashboards-6105f55cb7f566d8.md): ClickHouse · 2024-12-30 · Medium · 9 min read · Observability, Analytics & OLAP, Databases, Performance engineering
  ClickHouse ships a built-in Advanced Dashboard at /dashboard that charts query, MergeTree, OS and S3/cache metrics.
- [Essential Monitoring Queries - part 2 - SELECT Queries](https://swe.quest/articles/essential-monitoring-queries-part-2-select-queries-f0cc886a137efe02.md): ClickHouse · 2023-01-03 · Medium · 10 min read · Analytics & OLAP, Observability, Performance engineering, SQL
  A set of SQL queries against ClickHouse system tables (system.parts, system.query\_log, system.processes, system.stack\_trace) for monitoring and troubleshooting SELECT workloads: cluster size overview, most expensive queries, ProfileEvents diffs between two query versions, hourly duration trends, per-client query counts, and diagnosing TOO\_MANY\_SIMULTANEOUS\_QUERIES.
- [A simple guide to ClickHouse query optimization: part 1](https://swe.quest/articles/a-simple-guide-to-clickhouse-query-optimization-part-1-007f8d8516577455.md): ClickHouse · 2024-12-11 · Medium · 20 min read · Analytics & OLAP, Performance engineering, SQL, Query engines
  Slow ClickHouse queries can be diagnosed with system.query\_log (duration, rows read, memory, CPU, cache metrics) and the EXPLAIN statement, illustrated on the NYC Taxi dataset in the ClickHouse Playground.
- [ClickHouse and OpenTelemetry](https://swe.quest/articles/clickhouse-and-opentelemetry-84cdeb7807e844a6.md): ClickHouse · 2024-11-07 · Medium · 10 min read · Observability, Analytics & OLAP, Databases, Open source
  ClickHouse now officially supports the OpenTelemetry Collector exporter for ClickHouse, which has reached beta for logs and traces.
- [Essential Monitoring Queries - part 1 - INSERT Queries](https://swe.quest/articles/essential-monitoring-queries-part-1-insert-queries-eda633e3819dfbe1.md): ClickHouse · 2022-12-28 · Medium · 10 min read · Analytics & OLAP, Observability, SQL
  ClickHouse system tables such as part\_log, query\_log, asynchronous\_insert\_log, asynchronous\_metric\_log and parts can be queried with SQL to monitor and troubleshoot INSERT workloads.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
