β‘ Query Execution Pipeline
From SQL Text to Columnar Result β How ClickHouse Processes Every Query
π The Pipeline at a Glance
Every SELECT passes through these stages. Click a stage to learn more.
Parse
β
Analyze
β
Plan
β
Execute
β
Output
Click a stage above to see what happens inside.
π Parsing: SQL β Abstract Syntax Tree
ClickHouse uses a hand-written recursive descent parser (not yacc/bison). Type or pick a query to see its AST.
SELECT url, count() FROM hits WHERE date = '2024-03-01' GROUP BY url ORDER BY count() DESC LIMIT 10 Click "Parse to AST" to visualize the query tree
π Query Plan: The Processor DAG
ClickHouse builds a DAG of processors β each transforms data chunks. This replaces the old BlockInputStream model since v21.6+.
Source (ReadFromMergeTree) Transform (Filter / Expression) Aggregate (GroupBy) Sort / Limit Output