2825 explained code solutions for 75 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 │
└───────────┘

link_youtube: https://youtu.be/ddGtSKbxc5s