MCPcopy Index your code
hub / github.com/azat/chdig

github.com/azat/chdig @v26.6.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v26.6.1 ↗ · + Follow
936 symbols 2,933 edges 64 files 143 documented · 15% updated 17d agolatest · 2026-06-20★ 2879 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

chdig

Dig into ClickHouse with TUI interface.

Installation

chdig is also available as part of clickhouse - clickhouse chdig, but that version may be slightly outdated.

Pre-built packages (.deb, .rpm, archlinux, .tar.gz) and standalone binaries for Linux and macOS are available for both x86_64 and aarch64 architectures.

The latest unstable release can be found on GitHub.

See also the complete list of releases.

Package repositories (AUR, Scoop, Homebrew)

archlinux user repository (aur)

And also for archlinux there is an aur package: - chdig-latest-bin - binary artifact of the upstream - chdig-git - build from sources - chdig-bin - binary of the latest stable version

Note: chdig-latest-bin is recommended because it is latest available version and you don't need toolchain to compile

scoop (windows)

scoop bucket add extras
scoop install extras/chdig

brew (macos)

brew install chdig

Demo

asciicast

Motivation

The idea is came from everyday digging into various ClickHouse issues.

ClickHouse has a approximately universe of introspection tools, and it is easy to forget some of them. At first I came with some slides and a picture (to attract your attention) by analogy to what Brendan Gregg did for Linux:

Know Your ClickHouse

Note, the picture and the presentation had been made in the beginning of 2022, so it may not include some new introspection tools.

But this requires you to dig into lots of places, and even though during this process you will learn a lot, it does not solves the problem of forgetfulness. So I came up with this simple TUI interface that tries to make this process simpler.

chdig can be used not only to debug some problems, but also just as a regular introspection, like top for Linux.

Features

  • top like interface (or csysdig to be more precise)
  • Flamegraphs (CPU/Real/Memory/Live) in TUI (thanks to flamelens)
  • Perfetto support
  • Share flamegraphs (using pastila.nl and speedscope)
  • Share logs via pastila.nl
  • Share query pipelines (using viz.js and pastila.nl)
  • Cluster support (--cluster) - aggregate data from all hosts in the cluster
  • Historical support (--history) - includes rotated system.*_log_* tables
  • clickhouse-client compatibility (including --connection) for options and configuration files

And there is a huge bunch of ideas.

Note, this it is in a pre-alpha stage, so everything can be changed (keyboard shortcuts, views, color schema and of course features)

Requirements

If something does not work, like you have too old version of ClickHouse, consider upgrading.

Note: the oldest version that had been tested was 21.2 (at some point in time)

Build from sources

cargo build

[!NOTE] If you see an error like failed to authenticate when downloading repository: git@github.com:azat-rust/cursive, it is likely because your local Git config is rewriting https://github.com/ to git@github.com::

[url "git@github.com:"] insteadOf = https://github.com/

Cargo's built-in Git library does not handle this case gracefully. You can either remove that config entry or tell Cargo to use the system Git client instead:

```toml

~/.cargo/config.toml

[net] git-fetch-with-cli = true ```

For development and debugging information, see Documentation/Developers.md.

References

Extension points exported contracts — how you extend this code

ViewProvider (Interface)
Trait for providing views in the application. Each provider is responsible for showing a specific view type. [26 implementers]
src/view/provider.rs
TableViewItem (Interface)
A trait for displaying and sorting items inside a [`TableView`](struct.TableView.html). [4 implementers]
src/view/table_view.rs
ClickHouseSettingValue (Interface)
(no doc) [6 implementers]
src/view/providers/mod.rs
Navigation (Interface)
(no doc) [1 implementers]
src/view/navigation.rs

Core symbols most depended-on inside this repo

get
called by 169
src/view/registry.rs
is_empty
called by 120
src/view/log_store.rs
push
called by 95
src/common/sparkline.rs
len
called by 75
src/view/log_store.rs
send
called by 68
src/interpreter/worker.rs
query
called by 47
tests/common/mod.rs
as_str
called by 44
src/view/table_view.rs
get_log_table_name
called by 35
src/interpreter/clickhouse.rs

Shape

Method 532
Function 274
Class 111
Enum 15
Interface 4

Languages

Rust100%

Modules by API surface

src/view/table_view.rs92 symbols
src/interpreter/clickhouse.rs81 symbols
src/interpreter/options.rs68 symbols
src/interpreter/perfetto.rs61 symbols
src/view/queries_view.rs46 symbols
src/view/log_view.rs39 symbols
tests/integration.rs38 symbols
src/view/navigation.rs30 symbols
src/view/log_store.rs30 symbols
src/interpreter/debug_metrics.rs26 symbols
src/view/sql_query_view.rs25 symbols
tests/common/mod.rs24 symbols

For agents

$ claude mcp add chdig \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact