chadvisor workload is a prototype for moving ClickAdvisor from single-query
review to workload-level prioritization.
The command reads a sanitized CSV export from system.query_log, groups similar
queries by normalized SQL fingerprint, runs the representative query through the
deterministic rule engine, and ranks the groups by rule severity plus observed
resource metrics.
It does not connect to ClickHouse, execute SQL, read result data, or call an external LLM.
The CSV should include a query text column and any available metric columns.
Supported query columns:
querysqlnormalized_query
Supported metric columns:
query_duration_ms,duration_ms,elapsed_msread_rows,rows_read,rowsread_bytes,bytes_read,bytesmemory_usage,peak_memory_usage,memory_usage_bytes
Minimal export shape:
event_time,query,query_duration_ms,read_rows,read_bytes,memory_usage
2026-07-01 10:00:00,"SELECT * FROM events FINAL WHERE message LIKE '%timeout%'",1200,900000,180000000,220000000poetry run chadvisor workload \
--query-log examples/query_log_sample.csv \
--output-format markdown \
--top-n 3To save the report:
poetry run chadvisor workload \
--query-log examples/query_log_sample.csv \
--output-format markdown \
--output workload-report.mdJSON output is available for automation:
poetry run chadvisor workload \
--query-log examples/query_log_sample.csv \
--output-format jsonIf ClickAdvisor can reach the ClickHouse HTTP API, it can read recent
system.query_log metadata directly:
poetry run chadvisor workload \
--connect http://localhost:8123 \
--user default \
--password secret \
--since 24h \
--output-format markdown \
--top-n 10Supported --since values:
15m24h7d2w
The live mode runs a read-only query against system.query_log and requests
FORMAT CSVWithNames; the rest of the pipeline is the same as the CSV mode.
Top Performance Risks
1. Fingerprint 283ec787aa90fb0a
Priority: high
Executions: 2
Total duration: 2180 ms
Avg / p95 duration: 1090.0 / 1189 ms
Read rows / bytes: 1750000 / 350000000
Max memory: 220000000
Findings: 5
Rule IDs: D-003, D-004, D-005, D-007, R-102
The prototype priority score combines:
- deterministic rule severity from ClickAdvisor findings;
- total query duration;
- total read bytes;
- peak memory usage;
- execution count.
This is intentionally conservative. It is a review-queue signal, not a claim that ClickAdvisor has measured a guaranteed speedup.
For the safest workflow, export only metadata and normalized SQL. Literals can be redacted before the CSV reaches ClickAdvisor. The command itself normalizes literals for grouping, but upstream redaction is still recommended for strict enterprise environments.
Recommended read-only export columns:
SELECT
event_time,
query,
query_duration_ms,
read_rows,
read_bytes,
memory_usage
FROM system.query_log
WHERE type = 'QueryFinish'
AND event_time >= now() - INTERVAL 1 DAY
FORMAT CSVWithNamesThe future production version should add identifier hashing, stricter redaction modes, richer source filters, and ranking metrics such as Precision@K and NDCG@K.