9951 explained code solutions for 126 technologies


clickhouseGet table size


SELECT formatReadableSize(sum(bytes)) FROM system.parts WHERE active AND table = 'tbl';ctrl + c
formatReadableSize

converts bytes into human-readable form

sum(bytes)

get sum of all parts sizes of our table

system.parts

system table with table parts info

active

select only active parts

tbl

name of the table to get size for (tbl in our case)


Usage example

SELECT  formatReadableSize(sum(bytes)) as size FROM system.parts WHERE active AND table = 'tbl';
output
┌─size──────┐
│ 49.00 MiB │
└───────────┘