You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Documentation/sp_BlitzIndex_Checks_by_Priority.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,8 @@ Before adding a new check, make sure to add a Github issue for it first, and hav
6
6
7
7
If you want to change anything about a check - the priority, finding, URL, or ID - open a Github issue first. The relevant scripts have to be updated too.
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -288,6 +288,7 @@ In addition to the [parameters common to many of the stored procedures](#paramet
288
288
289
289
*@SkipPartitions = 1 - add this if you want to analyze large partitioned tables. We skip these by default for performance reasons.
290
290
*@SkipStatistics = 0 - right now, by default, we skip statistics analysis because we've had some performance issues on this.
291
+
*@UsualStatisticsSamplingPercent = 100 (default) - By default, @SkipStatistics = 0 with either @Mode = 0 or @Mode = 4 does not inform you of persisted statistics sample rates if that rate is 100. Use a different float if you usually persist a different sample percentage and do not want to be warned about it. Use NULL if you want to hear about every persisted sample rate.
291
292
*@Filter = 0 (default) - 1=No low-usage warnings for objects with 0 reads. 2=Only warn for objects >= 500MB
292
293
*@OutputDatabaseName, @OutputSchemaName, @OutputTableName - these only work for @Mode = 2, index usage detail.
Copy file name to clipboardExpand all lines: sp_BlitzIndex.sql
+79-8Lines changed: 79 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,7 @@ ALTER PROCEDURE dbo.sp_BlitzIndex
23
23
/*Note:@Filter doesn't do anything unless @Mode=0*/
24
24
@SkipPartitions BIT=0,
25
25
@SkipStatistics BIT=1,
26
+
@UsualStatisticsSamplingPercent FLOAT=100, /* FLOAT to match sys.dm_db_stats_properties. More detail later. 100 by default because Brent suggests that if people are persisting statistics at all, they are probably doing 100 in lots of places and not filtering that out would produce noise. */
26
27
@GetAllDatabases BIT=0,
27
28
@ShowColumnstoreOnly BIT=0, /* Will show only the Row Group and Segment details for a table with a columnstore index. */
28
29
@BringThePain BIT=0,
@@ -738,7 +739,8 @@ IF OBJECT_ID('tempdb..#dm_db_index_operational_stats') IS NOT NULL
THEN (N' rather than your expected @UsualStatisticsSamplingPercent value of '+CONVERT(NVARCHAR(100), @UsualStatisticsSamplingPercent) +'%')
4533
+
ELSE''
4534
+
END
4535
+
+N'. This may indicate that somebody is doing statistics rocket surgery. If not, consider updating statistics more frequently.'AS details,
4536
+
QUOTENAME(database_name) +'.'+QUOTENAME(s.schema_name) +'.'+QUOTENAME(s.table_name) +'.'+QUOTENAME(s.index_name) +'.'+QUOTENAME(s.statistics_name) +'.'+QUOTENAME(s.column_names) AS index_definition,
4537
+
'N/A'AS secret_columns,
4538
+
'N/A'AS index_usage_summary,
4539
+
'N/A'AS index_size_summary
4540
+
FROM #StatisticsAS s
4541
+
/*
4542
+
We have to do float comparison here, so it is time to explain why @UsualStatisticsSamplingPercent is a float.
4543
+
The foremost reason is that it is a float because we are comparing it to the persisted_sample_percent column in sys.dm_db_stats_properties and that column is a float.
4544
+
You may correctly object that CREATE STATISTICS with a decimal as your WITH SAMPLE [...] PERCENT is a syntax error and conclude that integers are enough.
4545
+
However, `WITH SAMPLE [...] ROWS` is allowed with PERSIST_SAMPLE_PERCENT = ON and you can use that to persist a non-integer sample rate.
4546
+
So, yes, we really have to use floats.
4547
+
*/
4548
+
WHERE
4549
+
/* persisted_sample_percent is either zero or NULL when the statistic is not persisted. */
CONVERT(NVARCHAR(100), COUNT(*)) +' statistic(s) with a persisted sample rate matching your desired persisted sample rate, '+CONVERT(NVARCHAR(100), @UsualStatisticsSamplingPercent) +N'%. Set @UsualStatisticsSamplingPercent to NULL if you want to see all of them in this result set. Its default value is 100.'AS details,
0 commit comments