Skip to content

Commit 55f1f3a

Browse files
authored
Merge pull request #2853 from Djheath2000/#2851_sp_BlitzIndex_Columnstore_Index_Visual
Issue 2851: sp_BlitzIndex - Only show Columnstore Index Visualisation details.
2 parents 0b9b033 + 88df88a commit 55f1f3a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

sp_BlitzIndex.sql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ALTER PROCEDURE dbo.sp_BlitzIndex
2323
@SkipPartitions BIT = 0,
2424
@SkipStatistics BIT = 1,
2525
@GetAllDatabases BIT = 0,
26+
@ShowColumnstoreOnly BIT = 0, /* Will show only the Row Group and Segment details for a table with a columnstore index. */
2627
@BringThePain BIT = 0,
2728
@IgnoreDatabases NVARCHAR(MAX) = NULL, /* Comma-delimited list of databases you want to skip */
2829
@ThresholdMB INT = 250 /* Number of megabytes that an object must be before we include it in basic results */,
@@ -2510,7 +2511,8 @@ BEGIN
25102511
--We do a left join here in case this is a disabled NC.
25112512
--In that case, it won't have any size info/pages allocated.
25122513

2513-
2514+
IF (@ShowColumnstoreOnly = 0)
2515+
BEGIN
25142516
WITH table_mode_cte AS (
25152517
SELECT
25162518
s.db_schema_object_indexid,
@@ -2701,7 +2703,8 @@ BEGIN
27012703
WHERE s.object_id = @ObjectID
27022704
ORDER BY s.auto_created, s.user_created, s.name, hist.step_number;';
27032705
EXEC sp_executesql @dsql, N'@ObjectID INT', @ObjectID;
2704-
END
2706+
END
2707+
END
27052708

27062709
/* Visualize columnstore index contents. More info: https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/2584 */
27072710
IF 2 = (SELECT SUM(1) FROM sys.all_objects WHERE name IN ('column_store_row_groups','column_store_segments'))
@@ -5173,7 +5176,7 @@ ELSE IF (@Mode=1) /*Summarize*/
51735176
ISNULL(i.index_name, '''') AS [Index Name],
51745177
CASE
51755178
WHEN i.is_primary_key = 1 AND i.index_definition <> ''[HEAP]''
5176-
THEN N''-ALTER TABLE '' + QUOTENAME(i.[database_name]) + N''.'' + QUOTENAME(i.[schema_name]) + N''.'' + QUOTENAME(i.[object_name]) +
5179+
THEN N''--ALTER TABLE '' + QUOTENAME(i.[database_name]) + N''.'' + QUOTENAME(i.[schema_name]) + N''.'' + QUOTENAME(i.[object_name]) +
51775180
N'' DROP CONSTRAINT '' + QUOTENAME(i.index_name) + N'';''
51785181
WHEN i.is_primary_key = 0 AND i.index_definition <> ''[HEAP]''
51795182
THEN N''--DROP INDEX ''+ QUOTENAME(i.index_name) + N'' ON '' + QUOTENAME(i.[database_name]) + N''.'' +

0 commit comments

Comments
 (0)