Skip to content

Commit

Permalink
ref(admin): Add a system query for data skipping indexes
Browse files Browse the repository at this point in the history
Add a system query for seeing the size of indexes on disk.
  • Loading branch information
evanh committed Jun 7, 2024
1 parent 76cc2ba commit ef5e206
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions snuba/admin/clickhouse/predefined_system_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit ef5e206

Please sign in to comment.