From ef5e2069e6882ef9164ea1ee6ea9035a67e84628 Mon Sep 17 00:00:00 2001 From: Evan Hicks Date: Fri, 7 Jun 2024 10:55:52 -0400 Subject: [PATCH] ref(admin): Add a system query for data skipping indexes Add a system query for seeing the size of indexes on disk. --- .../clickhouse/predefined_system_queries.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/snuba/admin/clickhouse/predefined_system_queries.py b/snuba/admin/clickhouse/predefined_system_queries.py index d58399ad32..b217f7cdab 100644 --- a/snuba/admin/clickhouse/predefined_system_queries.py +++ b/snuba/admin/clickhouse/predefined_system_queries.py @@ -134,6 +134,27 @@ class ColumnSizeOnDisk(SystemQuery): """ +class IndexSizeOnDisk(SystemQuery): + """ + Lists the data skipping indexes as well as their sizes on disk. This table has no + sense of time, so it's just a snapshot of the current state. + """ + + sql = """ + SELECT + name, + type_full, + expr, + granularity, + formatReadableSize(data_compressed_bytes AS size) AS compressed, + formatReadableSize(data_uncompressed_bytes AS usize) AS uncompressed, + round(usize / size, 2) AS compr_ratio, + marks + FROM system.data_skipping_indices + WHERE table = '{{table}}' + """ + + class PartCreations(SystemQuery): """ New parts created in the last 10 minutes. Replicas have event_type 'DownloadPart',