Skip to content

Commit 6aa49cb

Browse files
authored
Merge pull request #3737 from BrentOzarULTD/3736_sp_BlitzIndex_JSON_prelim
#3736 sp_BlitzIndex JSON
2 parents aadc04c + 2663088 commit 6aa49cb

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
@@ -329,6 +329,7 @@ IF OBJECT_ID('tempdb..#dm_db_index_operational_stats') IS NOT NULL
329329
is_spatial BIT NOT NULL,
330330
is_NC_columnstore BIT NOT NULL,
331331
is_CX_columnstore BIT NOT NULL,
332+
is_JSON BIT NOT NULL,
332333
is_in_memory_oltp BIT NOT NULL ,
333334
is_disabled BIT NOT NULL ,
334335
is_hypothetical BIT NOT NULL ,
@@ -370,6 +371,7 @@ IF OBJECT_ID('tempdb..#dm_db_index_operational_stats') IS NOT NULL
370371
ELSE N'' END + CASE WHEN is_XML = 1 THEN N'[XML] '
371372
ELSE N'' END + CASE WHEN is_spatial = 1 THEN N'[SPATIAL] '
372373
ELSE N'' END + CASE WHEN is_NC_columnstore = 1 THEN N'[COLUMNSTORE] '
374+
ELSE N'' END + CASE WHEN is_json = 1 THEN N'[JSON] '
373375
ELSE N'' END + CASE WHEN is_in_memory_oltp = 1 THEN N'[IN-MEMORY] '
374376
ELSE N'' END + CASE WHEN is_disabled = 1 THEN N'[DISABLED] '
375377
ELSE N'' END + CASE WHEN is_hypothetical = 1 THEN N'[HYPOTHETICAL] '
@@ -1414,6 +1416,7 @@ BEGIN TRY
14141416
CASE when si.type = 4 THEN 1 ELSE 0 END AS is_spatial,
14151417
CASE when si.type = 6 THEN 1 ELSE 0 END AS is_NC_columnstore,
14161418
CASE when si.type = 5 then 1 else 0 end as is_CX_columnstore,
1419+
CASE when si.type = 9 then 1 else 0 end as is_JSON,
14171420
CASE when si.data_space_id = 0 then 1 else 0 end as is_in_memory_oltp,
14181421
si.is_disabled,
14191422
si.is_hypothetical,
@@ -1447,8 +1450,8 @@ BEGIN TRY
14471450
LEFT JOIN sys.dm_db_index_usage_stats AS us WITH (NOLOCK) ON si.[object_id] = us.[object_id]
14481451
AND si.index_id = us.index_id
14491452
AND us.database_id = ' + CAST(@DatabaseID AS NVARCHAR(10)) + N'
1450-
WHERE si.[type] IN ( 0, 1, 2, 3, 4, 5, 6 )
1451-
/* Heaps, clustered, nonclustered, XML, spatial, Cluster Columnstore, NC Columnstore */ ' +
1453+
WHERE si.[type] IN ( 0, 1, 2, 3, 4, 5, 6, 9 )
1454+
/* Heaps, clustered, nonclustered, XML, spatial, Cluster Columnstore, NC Columnstore, JSON */ ' +
14521455
CASE WHEN @TableName IS NOT NULL THEN N' and so.name=' + QUOTENAME(@TableName,N'''') + N' ' ELSE N'' END +
14531456
CASE WHEN ( @IncludeInactiveIndexes = 0
14541457
AND @Mode IN (0, 4)
@@ -1476,7 +1479,7 @@ BEGIN TRY
14761479
PRINT SUBSTRING(@dsql, 36000, 40000);
14771480
END;
14781481
INSERT #IndexSanity ( [database_id], [object_id], [index_id], [index_type], [database_name], [schema_name], [object_name],
1479-
index_name, is_indexed_view, is_unique, is_primary_key, is_unique_constraint, is_XML, is_spatial, is_NC_columnstore, is_CX_columnstore, is_in_memory_oltp,
1482+
index_name, is_indexed_view, is_unique, is_primary_key, is_unique_constraint, is_XML, is_spatial, is_NC_columnstore, is_CX_columnstore, is_JSON, is_in_memory_oltp,
14801483
is_disabled, is_hypothetical, is_padded, fill_factor, filter_definition, [optimize_for_sequential_key], user_seeks, user_scans,
14811484
user_lookups, user_updates, last_user_seek, last_user_scan, last_user_lookup, last_user_update,
14821485
create_date, modify_date )

0 commit comments

Comments
 (0)