SELECT
database,
table,
formatReadableSize(sum(data_compressed_bytes) AS size) AS compressed,
formatReadableSize(sum(data_uncompressed_bytes) AS usize) AS uncompressed,
round(usize / size, 2) AS compr_rate,
sum(rows) AS rows,
count() AS part_count
FROM system.parts
WHERE (active = 1) AND (database LIKE '%') AND (table LIKE '%')
GROUP BY
database,
table
ORDER BY size DESC;
It gives you the tables and their sizes. We will know which ones have the maximum size and take some action
a
Ailen
12/03/2022, 6:05 AM
thx for your reply, where can i run this query?
s
Srikanth Chekuri
12/03/2022, 7:40 AM
You need to connect to clickhouse and run this.
a
Ailen
12/03/2022, 9:17 AM
Hello, this is my screenshot of the query
Ailen
12/03/2022, 9:20 AM
how can i optimize the storage thx
Ailen
12/03/2022, 9:42 AM
I just want keep recent 3 days data, what should i do?
s
Srikanth Chekuri
12/03/2022, 11:15 AM
The compressed data is around ~5GB in total for SigNoz so you may have something else taking up the remaining disk space. Please refer to this guide for setting retention https://signoz.io/docs/userguide/retention-period/
SigNoz is an open-source APM. It helps developers monitor their applications & troubleshoot problems, an open-source alternative to DataDog, NewRelic, etc.