Skip to content

Commit fd38659

Browse files
committed
#296 sp_BlitzIndex add a little Hekaton support
Adds a little Hekaton support, documents support levels for other indexes. Closes #296.
1 parent 871122d commit fd38659

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,15 @@ Common parameters include:
247247
* @ThresholdMB = 250 - by default, we only analyze objects over 250MB because you're busy.
248248
* @Mode = 0 (default) - get different data with 0=Diagnose, 1=Summarize, 2=Index Usage Detail, 3=Missing Index Detail, 4=Diagnose Details.
249249

250+
sp_BlitzIndex focuses on mainstream index types. Other index types have varying amounts of support:
251+
252+
* Fully supported: rowstore indexes, columnstore indexes, temporal tables.
253+
* Columnstore indexes: fully supported. Key columns are shown as includes rather than keys since they're not in a specific order.
254+
* In-Memory OLTP (Hekaton): unsupported. These objects show up in the results, but for more info, you'll want to use sp_BlitzInMemoryOLTP instead.
255+
* Graph tables: unsupported. These objects show up in the results, but we don't do anything special with 'em, like call out that they're graph tables.
256+
* Spatial indexes: unsupported. We call out that they're spatial, but we don't do any special handling for them.
257+
* XML indexes: unsupported. These objects show up in the results, but we don't include the index's columns or sizes.
258+
250259

251260
[*Back to top*](#header1)
252261

sp_BlitzIndex.sql

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ IF OBJECT_ID('tempdb..#Ignore_Databases') IS NOT NULL
258258
is_spatial BIT NOT NULL,
259259
is_NC_columnstore BIT NOT NULL,
260260
is_CX_columnstore BIT NOT NULL,
261+
is_in_memory_oltp BIT NOT NULL ,
261262
is_disabled BIT NOT NULL ,
262263
is_hypothetical BIT NOT NULL ,
263264
is_padded BIT NOT NULL ,
@@ -298,6 +299,7 @@ IF OBJECT_ID('tempdb..#Ignore_Databases') IS NOT NULL
298299
ELSE N'' END + CASE WHEN is_XML = 1 THEN N'[XML] '
299300
ELSE N'' END + CASE WHEN is_spatial = 1 THEN N'[SPATIAL] '
300301
ELSE N'' END + CASE WHEN is_NC_columnstore = 1 THEN N'[COLUMNSTORE] '
302+
ELSE N'' END + CASE WHEN is_in_memory_oltp = 1 THEN N'[IN-MEMORY] '
301303
ELSE N'' END + CASE WHEN is_disabled = 1 THEN N'[DISABLED] '
302304
ELSE N'' END + CASE WHEN is_hypothetical = 1 THEN N'[HYPOTHETICAL] '
303305
ELSE N'' END + CASE WHEN is_unique = 1 AND is_primary_key = 0 THEN N'[UNIQUE] '
@@ -328,8 +330,12 @@ IF OBJECT_ID('tempdb..#Ignore_Databases') IS NOT NULL
328330
ELSE N' ' END
329331
+ N'Writes:' +
330332
REPLACE(CONVERT(NVARCHAR(30),CAST(user_updates AS MONEY), 1), N'.00', N''),
331-
[more_info] AS N'EXEC dbo.sp_BlitzIndex @DatabaseName=' + QUOTENAME([database_name],N'''') +
332-
N', @SchemaName=' + QUOTENAME([schema_name],N'''') + N', @TableName=' + QUOTENAME([object_name],N'''') + N';'
333+
[more_info] AS
334+
CASE WHEN is_in_memory_oltp = 1
335+
THEN N'EXEC dbo.sp_BlitzInMemoryOLTP @dbName=' + QUOTENAME([database_name],N'''') +
336+
N', @tableName=' + QUOTENAME([object_name],N'''') + N';'
337+
ELSE N'EXEC dbo.sp_BlitzIndex @DatabaseName=' + QUOTENAME([database_name],N'''') +
338+
N', @SchemaName=' + QUOTENAME([schema_name],N'''') + N', @TableName=' + QUOTENAME([object_name],N'''') + N';' END
333339
);
334340
RAISERROR (N'Adding UQ index on #IndexSanity (database_id, object_id, index_id)',0,1) WITH NOWAIT;
335341
IF NOT EXISTS(SELECT 1 FROM tempdb.sys.indexes WHERE name='uq_database_id_object_id_index_id')
@@ -1202,6 +1208,7 @@ BEGIN TRY
12021208
CASE when si.type = 4 THEN 1 ELSE 0 END AS is_spatial,
12031209
CASE when si.type = 6 THEN 1 ELSE 0 END AS is_NC_columnstore,
12041210
CASE when si.type = 5 then 1 else 0 end as is_CX_columnstore,
1211+
CASE when si.data_space_id = 0 then 1 else 0 end as is_in_memory_oltp,
12051212
si.is_disabled,
12061213
si.is_hypothetical,
12071214
si.is_padded,
@@ -1257,7 +1264,7 @@ BEGIN TRY
12571264
PRINT SUBSTRING(@dsql, 36000, 40000);
12581265
END;
12591266
INSERT #IndexSanity ( [database_id], [object_id], [index_id], [index_type], [database_name], [schema_name], [object_name],
1260-
index_name, is_indexed_view, is_unique, is_primary_key, is_XML, is_spatial, is_NC_columnstore, is_CX_columnstore,
1267+
index_name, is_indexed_view, is_unique, is_primary_key, is_XML, is_spatial, is_NC_columnstore, is_CX_columnstore, is_in_memory_oltp,
12611268
is_disabled, is_hypothetical, is_padded, fill_factor, filter_definition, user_seeks, user_scans,
12621269
user_lookups, user_updates, last_user_seek, last_user_scan, last_user_lookup, last_user_update,
12631270
create_date, modify_date )
@@ -4163,6 +4170,27 @@ BEGIN;
41634170
OPTION ( RECOMPILE );
41644171
END;
41654172

4173+
RAISERROR(N'check_id 73: In-Memory OLTP', 0,1) WITH NOWAIT;
4174+
INSERT #BlitzIndexResults ( check_id, index_sanity_id, Priority, findings_group, finding, [database_name], URL, details, index_definition,
4175+
secret_columns, index_usage_summary, index_size_summary )
4176+
SELECT 73 AS check_id,
4177+
i.index_sanity_id,
4178+
150 AS Priority,
4179+
N'Abnormal Psychology' AS findings_group,
4180+
N'In-Memory OLTP' AS finding,
4181+
[database_name] AS [Database Name],
4182+
N'http://BrentOzar.com/go/AbnormalPsychology' AS URL,
4183+
i.db_schema_object_indexid AS details,
4184+
i.index_definition,
4185+
i.secret_columns,
4186+
i.index_usage_summary,
4187+
ISNULL(sz.index_size_summary,'') AS index_size_summary
4188+
FROM #IndexSanity AS i
4189+
JOIN #IndexSanitySize sz ON i.index_sanity_id = sz.index_sanity_id
4190+
WHERE i.is_in_memory_oltp = 1
4191+
AND NOT (@GetAllDatabases = 1 OR @Mode = 0)
4192+
OPTION ( RECOMPILE );
4193+
41664194
END;
41674195

41684196
----------------------------------------
@@ -4758,6 +4786,7 @@ BEGIN;
47584786
[is_spatial] BIT,
47594787
[is_NC_columnstore] BIT,
47604788
[is_CX_columnstore] BIT,
4789+
[is_in_memory_oltp] BIT,
47614790
[is_disabled] BIT,
47624791
[is_hypothetical] BIT,
47634792
[is_padded] BIT,
@@ -4867,6 +4896,7 @@ BEGIN;
48674896
[is_spatial],
48684897
[is_NC_columnstore],
48694898
[is_CX_columnstore],
4899+
[is_in_memory_oltp],
48704900
[is_disabled],
48714901
[is_hypothetical],
48724902
[is_padded],
@@ -4952,6 +4982,7 @@ BEGIN;
49524982
is_spatial AS [Is Spatial],
49534983
is_NC_columnstore AS [Is NC Columnstore],
49544984
is_CX_columnstore AS [Is CX Columnstore],
4985+
is_in_memory_oltp AS [Is In-Memory OLTP],
49554986
is_disabled AS [Is Disabled],
49564987
is_hypothetical AS [Is Hypothetical],
49574988
is_padded AS [Is Padded],
@@ -5044,6 +5075,7 @@ BEGIN;
50445075
is_spatial AS [Is Spatial],
50455076
is_NC_columnstore AS [Is NC Columnstore],
50465077
is_CX_columnstore AS [Is CX Columnstore],
5078+
is_in_memory_oltp AS [Is In-Memory OLTP],
50475079
is_disabled AS [Is Disabled],
50485080
is_hypothetical AS [Is Hypothetical],
50495081
is_padded AS [Is Padded],

0 commit comments

Comments
 (0)