docs(clickhouse): add SQL to calculate average uncompressed row size per table and close code fence

This commit is contained in:
Nawaz Dhandala
2025-10-27 13:46:24 +00:00
parent 1ef27b7f52
commit 4eb46cf8a0

View File

@@ -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;
```