clickhouse disk usage code example

Example: clickhouse disk usage

SELECT database, 
         table,
         formatReadableSize(sum(bytes)) as size
    FROM system.parts
   WHERE active
GROUP BY database,
         table
ORDER BY sum(bytes) desc

/*
┌─database─┬─table───────────┬─size────────┐
│ system   │ query_log       │ 41.87 MiB   │
│ tmp      │ test            │ 305.00 B    │
└──────────┴─────────────────┴─────────────┘
*/

Tags: