From 4eb46cf8a0d74c7918c6efa713cf1ac502641425 Mon Sep 17 00:00:00 2001 From: Nawaz Dhandala Date: Mon, 27 Oct 2025 13:46:24 +0000 Subject: [PATCH] docs(clickhouse): add SQL to calculate average uncompressed row size per table and close code fence --- HelmChart/Docs/Clickhouse.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/HelmChart/Docs/Clickhouse.md b/HelmChart/Docs/Clickhouse.md index 800a113fdc..a81f075a89 100644 --- a/HelmChart/Docs/Clickhouse.md +++ b/HelmChart/Docs/Clickhouse.md @@ -66,4 +66,21 @@ ORDER BY elapsed DESC; ```sql KILL QUERY WHERE query_id = 'your_query_id'; +``` + + +#### Get size of avg row in bytes by table. + +``` +SELECT + c.table, + sum(c.data_uncompressed_bytes) AS total_uncompressed_bytes, + t.total_rows, + sum(c.data_uncompressed_bytes) / t.total_rows AS avg_uncompressed_row_size_bytes +FROM system.columns c +JOIN system.tables t + ON c.database = t.database AND c.table = t.name +WHERE c.database = 'oneuptime' +GROUP BY c.table, t.total_rows +ORDER BY avg_uncompressed_row_size_bytes DESC; ``` \ No newline at end of file