Skip to content

Commit

Permalink
#3294 sp_BlitzIndex: add dictionary sizes
Browse files Browse the repository at this point in the history
In the columnstore visualization, secondary dictionary only. Working on #3294.
  • Loading branch information
BrentOzar committed Jun 30, 2023
1 parent 8335aa4 commit 4bb9866
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sp_BlitzIndex.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2974,7 +2974,7 @@ BEGIN
FROM (
SELECT c.name AS column_name, p.partition_number, rg.row_group_id, rg.total_rows, rg.deleted_rows,
phys.state_desc, phys.trim_reason_desc, phys.transition_to_compressed_state_desc, phys.has_vertipaq_optimization,
details = CAST(seg.min_data_id AS VARCHAR(20)) + '' to '' + CAST(seg.max_data_id AS VARCHAR(20)) + '', '' + CAST(CAST((seg.on_disk_size / 1024.0 / 1024) AS DECIMAL(18,0)) AS VARCHAR(20)) + '' MB'''
details = CAST(seg.min_data_id AS VARCHAR(20)) + '' to '' + CAST(seg.max_data_id AS VARCHAR(20)) + '', '' + CAST(CAST(((COALESCE(d.on_disk_size,0) + COALESCE(seg.on_disk_size,0)) / 1024.0 / 1024) AS DECIMAL(18,0)) AS VARCHAR(20)) + '' MB'''
+ CASE WHEN @ShowPartitionRanges = 1 THEN N',
CASE
WHEN pp.system_type_id IN (40, 41, 42, 43, 58, 61) THEN 126
Expand All @@ -2997,6 +2997,7 @@ BEGIN
LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.partition_range_values prvs ON prvs.function_id = pf.function_id AND prvs.boundary_id = p.partition_number - 1
LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.partition_range_values prve ON prve.function_id = pf.function_id AND prve.boundary_id = p.partition_number ' ELSE N' ' END
+ N' LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.column_store_segments seg ON p.partition_id = seg.partition_id AND ic.index_column_id = seg.column_id AND rg.row_group_id = seg.segment_id
LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.column_store_dictionaries d ON p.hobt_id = d.hobt_id AND c.column_id = d.column_id AND seg.secondary_dictionary_id = d.dictionary_id
WHERE rg.object_id = @ObjectID
AND rg.state IN (1, 2, 3)
AND c.name IN ( ' + @ColumnListWithApostrophes + N')'
Expand Down Expand Up @@ -3034,6 +3035,9 @@ BEGIN
RAISERROR(N'Done visualizing columnstore index contents.', 0,1) WITH NOWAIT;
END

IF @ShowColumnstoreOnly = 1
RETURN;

END; /* IF @TableName IS NOT NULL */


Expand Down

0 comments on commit 4bb9866

Please sign in to comment.