Title: Provide meta function to query column index sizes
Description:
StarRocks already provides functions like column_size and column_compressed_size to inspect the storage size of a column. However, there is currently no way to check the index size of a column. Indexes can consume a significant portion of storage, and visibility is important for diagnostics and optimization.
Proposed Feature: Introduce a meta function for index sizes, aligned with the style of existing column size functions.
Function Signature (proposal):
-- Must be used in META scan context (same style as column_size/column_compressed_size)
index_size(column_ref [, 'BITMAP' | 'INVERTED' | 'ZONEMAP' | 'BLOOM' | 'ALL']) -> BIGINT
Behavior:
FROM <table> [_META_] context.'ALL', returns the sum of all index sizes for that column.'BITMAP'), only that type’s size is returned.column_size(col) / column_compressed_size(col) (aggregation from segment metadata).Examples:
-- Total size of all indexes on the column
SELECT index_size(lo_orderdate)
FROM ssb.lineorder [_META_];
-- Size of a specific index type
SELECT index_size(lo_orderdate, 'BITMAP')
FROM ssb.lineorder [_META_];
-- With partition/tablet hint (if supported)
SELECT index_size(lo_orderdate, 'INVERTED')
FROM ssb.lineorder PARTITION(p202409) [_META_];
Use Cases:
Impact: Provides a consistent and simple way to measure index sizes, aligned with the existing meta functions for column sizes.
TODO (Future Work):
Consider exposing the same index size information in information_schema for easier programmatic access and integration with monitoring tools.