diff --git a/sp_PerfCheck/sp_PerfCheck.sql b/sp_PerfCheck/sp_PerfCheck.sql index 1195b339..40643546 100644 --- a/sp_PerfCheck/sp_PerfCheck.sql +++ b/sp_PerfCheck/sp_PerfCheck.sql @@ -387,7 +387,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. name sysname NOT NULL, database_id integer NOT NULL, compatibility_level tinyint NOT NULL, - collation_name sysname NOT NULL, + collation_name sysname NULL, user_access_desc nvarchar(60) NOT NULL, is_read_only bit NOT NULL, is_auto_close_on bit NOT NULL, @@ -2381,7 +2381,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THEN 0 ELSE CONVERT(decimal(18, 2), SUM(fs.io_stall_write_ms) * 1.0 / SUM(fs.num_of_writes)) END, - total_size_mb = CONVERT(decimal(18, 2), SUM(mf.size) * 8.0 / 1024.0) + total_size_mb = CONVERT(decimal(18, 2), SUM(CONVERT(bigint, mf.size)) * 8.0 / 1024.0) FROM sys.dm_io_virtual_file_stats (' + CASE @@ -2581,9 +2581,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. CONVERT(nvarchar(10), CONVERT(decimal(10, 2), io.avg_write_stall_ms)) + N' ms. ' + N'Total read: ' + - CONVERT(nvarchar(20), CONVERT(decimal(10, 2), io.read_io_mb)) + + CONVERT(nvarchar(20), CONVERT(decimal(18, 2), io.read_io_mb)) + N' MB, Total write: ' + - CONVERT(nvarchar(20), CONVERT(decimal(10, 2), io.write_io_mb)) + + CONVERT(nvarchar(20), CONVERT(decimal(18, 2), io.write_io_mb)) + N' MB. ' + N'This indicates slow I/O subsystem performance for this database.', url = N'https://erikdarling.com/sp_PerfCheck#IOStalls' diff --git a/sp_PressureDetector/sp_PressureDetector.sql b/sp_PressureDetector/sp_PressureDetector.sql index fc6bcaf4..5a6899b2 100644 --- a/sp_PressureDetector/sp_PressureDetector.sql +++ b/sp_PressureDetector/sp_PressureDetector.sql @@ -870,7 +870,7 @@ OPTION(MAXDOP 1, RECOMPILE);', writes bigint NULL, logical_reads bigint NULL, granted_query_memory_gb decimal(38,2) NULL, - transaction_isolation_level nvarchar(30) NULL, + transaction_isolation_level sysname NULL, dop integer NULL, parallel_worker_count integer NULL, plan_handle varbinary(64) NULL, diff --git a/sp_QuickieStore/README.md b/sp_QuickieStore/README.md index c7b73023..59ccd568 100644 --- a/sp_QuickieStore/README.md +++ b/sp_QuickieStore/README.md @@ -51,7 +51,7 @@ Use the `@expert_mode` parameter to return additional details. | @query_text_search | nvarchar | query text to search for | a string; leading and trailing wildcards will be added if missing | NULL | | @query_text_search_not | nvarchar | query text to exclude | a string; leading and trailing wildcards will be added if missing | NULL | | @escape_brackets | bit | Set this bit to 1 to search for query text containing square brackets (common in .NET Entity Framework and other ORM queries) | 0 or 1 | 0 | -| @escape_character | nchar | Sets the ESCAPE character for special character searches, defaults to the SQL standard backslash (\) character | some escape character, SQL standard is backslash (\) | \ | +| @escape_character | nchar | Sets the ESCAPE character for special character searches, defaults to the SQL standard backslash (\\) character | some escape character, SQL standard is backslash (\\) | \ | | @only_queries_with_hints | bit | only return queries with query hints | 0 or 1 | 0 | | @only_queries_with_feedback | bit | only return queries with query feedback | 0 or 1 | 0 | | @only_queries_with_variants | bit | only return queries with query variants | 0 or 1 | 0 | @@ -73,6 +73,7 @@ Use the `@expert_mode` parameter to return additional details. | @regression_comparator | varchar | what difference to use ('relative' or 'absolute') when comparing @sort_order's metric for the normal time period with any regression time period. | relative, absolute | NULL; absolute if @regression_baseline_start_date is specified | | @regression_direction | varchar | when comparing against any regression baseline, what do you want the results sorted by ('magnitude', 'improved', or 'regressed')? | regressed, worse, improved, better, magnitude, absolute, whatever | NULL; regressed if @regression_baseline_start_date is specified | | @include_query_hash_totals | bit | will add an additional column to final output with total resource usage by query hash | 0 or 1 | 0 | +| @include_maintenance | bit | Set this bit to 1 to add maintenance operations such as index creation to the result set | 0 or 1 | 0 | | @help | bit | how you got here | 0 or 1 | 0 | | @debug | bit | prints dynamic sql, statement length, parameter and variable values, and raw temp table contents | 0 or 1 | 0 | | @troubleshoot_performance | bit | set statistics xml on for queries against views | 0 or 1 | 0 | @@ -129,4 +130,4 @@ EXECUTE dbo.sp_QuickieStore ## Resources * [YouTube playlist](https://www.youtube.com/playlist?list=PLt4QZ-7lfQie1XZHEm0HN-Zt1S7LFEx1P) -* [Blog post](https://www.erikdarling.com/sp_quickiestore/) \ No newline at end of file +* [Blog post](https://www.erikdarling.com/sp_quickiestore/) diff --git a/sp_QuickieStore/sp_QuickieStore.sql b/sp_QuickieStore/sp_QuickieStore.sql index 75252b4c..4a452361 100644 --- a/sp_QuickieStore/sp_QuickieStore.sql +++ b/sp_QuickieStore/sp_QuickieStore.sql @@ -100,6 +100,7 @@ ALTER PROCEDURE @regression_comparator varchar(20) = NULL, /*what difference to use ('relative' or 'absolute') when comparing @sort_order's metric for the normal time period with the regression time period.*/ @regression_direction varchar(20) = NULL, /*when comparing against the regression baseline, want do you want the results sorted by ('magnitude', 'improved', or 'regressed')?*/ @include_query_hash_totals bit = 0, /*will add an additional column to final output with total resource usage by query hash, may be skewed by query_hash and query_plan_hash bugs with forced plans/plan guides*/ + @include_maintenance bit = 0, /*Set this bit to 1 to add maintenance operations such as index creation to the result set*/ @help bit = 0, /*return available parameter details, etc.*/ @debug bit = 0, /*prints dynamic sql, statement length, parameter and variable values, and raw temp table contents*/ @troubleshoot_performance bit = 0, /*set statistics xml on for queries against views*/ @@ -215,6 +216,7 @@ BEGIN WHEN N'@regression_comparator' THEN 'what difference to use (''relative'' or ''absolute'') when comparing @sort_order''s metric for the normal time period with any regression time period.' WHEN N'@regression_direction' THEN 'when comparing against any regression baseline, what do you want the results sorted by (''magnitude'', ''improved'', or ''regressed'')?' WHEN N'@include_query_hash_totals' THEN N'will add an additional column to final output with total resource usage by query hash, may be skewed by query_hash and query_plan_hash bugs with forced plans/plan guides' + WHEN N'@include_maintenance' THEN N'Set this bit to 1 to add maintenance operations such as index creation to the result set' WHEN N'@help' THEN 'how you got here' WHEN N'@debug' THEN 'prints dynamic sql, statement length, parameter and variable values, and raw temp table contents' WHEN N'@troubleshoot_performance' THEN 'set statistics xml on for queries against views' @@ -270,6 +272,7 @@ BEGIN WHEN N'@regression_comparator' THEN 'relative, absolute' WHEN N'@regression_direction' THEN 'regressed, worse, improved, better, magnitude, absolute, whatever' WHEN N'@include_query_hash_totals' THEN N'0 or 1' + WHEN N'@include_maintenance' THEN N'0 or 1' WHEN N'@help' THEN '0 or 1' WHEN N'@debug' THEN '0 or 1' WHEN N'@troubleshoot_performance' THEN '0 or 1' @@ -325,6 +328,7 @@ BEGIN WHEN N'@regression_comparator' THEN 'NULL; absolute if @regression_baseline_start_date is specified' WHEN N'@regression_direction' THEN 'NULL; regressed if @regression_baseline_start_date is specified' WHEN N'@include_query_hash_totals' THEN N'0' + WHEN N'@include_maintenance' THEN N'0' WHEN N'@help' THEN '0' WHEN N'@debug' THEN '0' WHEN N'@troubleshoot_performance' THEN '0' @@ -782,7 +786,7 @@ Hold plan_ids for matching wait filter CREATE TABLE #wait_filter ( - plan_id bigint PRIMARY KEY + plan_id bigint PRIMARY KEY CLUSTERED ); /* @@ -1276,19 +1280,19 @@ CREATE TABLE CREATE TABLE #include_databases ( - database_name sysname PRIMARY KEY + database_name sysname PRIMARY KEY CLUSTERED ); CREATE TABLE #exclude_databases ( - database_name sysname PRIMARY KEY + database_name sysname PRIMARY KEY CLUSTERED ); CREATE TABLE #requested_but_skipped_databases ( - database_name sysname PRIMARY KEY, + database_name sysname PRIMARY KEY CLUSTERED, reason varchar(100) NOT NULL ); @@ -2716,6 +2720,8 @@ SELECT ISNULL(@workdays, 0), @include_query_hash_totals = ISNULL(@include_query_hash_totals, 0), + @include_maintenance = + ISNULL(@include_maintenance, 0), /* doing start and end date last because they're more complicated if start or end date is null, @@ -5145,7 +5151,8 @@ END; /* This section screens out index create and alter statements because who cares */ - +IF @include_maintenance = 0 +BEGIN SELECT @current_table = 'inserting #maintenance_plans', @sql = @isolation_level; @@ -5225,6 +5232,7 @@ SELECT FROM #maintenance_plans AS mp WHERE mp.plan_id = qsrs.plan_id )' + @nc10; +END; /* Tidy up the where clause a bit @@ -10208,6 +10216,8 @@ BEGIN @regression_direction, include_query_hash_totals = @include_query_hash_totals, + include_maintenance = + @include_maintenance, help = @help, debug =