Danila Fediashchin
07/30/2026, 6:36 PMRocky
07/30/2026, 6:36 PMcolumn_compressed_size and [_META_] Hint
StarRocks provides specialized functions to inspect column-level metadata. These functions must be used with the [_META_] hint, which directs the query engine to perform a META_SCAN on segment file headers rather than scanning the actual data.
* column_compressed_size(column_name): Returns the actual on-disk (compressed) size in bytes.
* column_size(column_name): Returns the decompressed size in bytes.
To get column sizes for a specific tablet:
You can include the hidden column __tablet_id in your query to group the results.
sql
SELECT
__tablet_id,
SUM(column_compressed_size(your_column_name)) AS column_disk_size
FROM your_table_name [_META_]
-- Optional: filter by specific tablet
-- WHERE __tablet_id = 12345
GROUP BY __tablet_id;
To get column sizes for a specific partition:
You can filter the query by your partition key or use the PARTITION keyword to narrow down the scope.
sql
SELECT
SUM(column_compressed_size(column1)) AS col1_size,
SUM(column_compressed_size(column2)) AS col2_size
FROM your_table_name PARTITION (p202301) [_META_];
2. Using System Statistics Tables
If you don't need real-time precision and want to check general storage distribution, you can query the internal statistics database. StarRocks periodically collects column-level data size metrics for the Cost-Based Optimizer (CBO).
sql
SELECT
partition_name,
column_name,
data_size -- Estimated size in bytes
FROM _statistics_.column_statistics
WHERE table_name = 'your_table_name';
Note: These values are estimates based on the last statistics collection task.
3. Summary of Granularity Options
Requirement | Recommended Method
Exact size on disk (Per Column) | SELECT column_compressed_size(col) FROM table [_META_]
Size per Tablet (Total) | SHOW TABLET FROM table or SELECT * FROM information_schema.be_tablets
Size per Partition (Total) | SHOW PARTITIONS FROM table or information_schema.partitions_meta
Important Note: The [_META_] hint and column_compressed_size functions are available in StarRocks v3.1 and later. If you are on an older version, column-level storage information is primarily available via the _statistics_ database.
References
• sql-reference/sql-functions/utility-functions/column_size_functions.md
• sql-reference/information_schema/be_tablets.md
• sql-reference/information_schema/columns.md
• sql-reference/sql-statements/table_bucket_part_index/SHOW_TABLET.md