From be5847a239b2b35a434238075ec883921cc0c23c Mon Sep 17 00:00:00 2001 From: Petar-T Date: Tue, 30 Apr 2019 01:09:00 +0200 Subject: [PATCH 1/3] Fix For Query Store bug --- BPCheck/Check_BP_Servers.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BPCheck/Check_BP_Servers.sql b/BPCheck/Check_BP_Servers.sql index 2951cfbc..b46f1b85 100644 --- a/BPCheck/Check_BP_Servers.sql +++ b/BPCheck/Check_BP_Servers.sql @@ -6377,7 +6377,7 @@ FROM sys.database_query_store_options;' SET isdone = 1 WHERE [dbid] = @dbid END - END + --END IF (SELECT COUNT([DBName]) FROM #tblQStoreInfo) > 0 BEGIN @@ -6391,7 +6391,7 @@ FROM sys.database_query_store_options;' SELECT 'Information' AS [Category], 'Query_Store' AS [Information] , '[INFORMATION: No databases have Query Store enabled]' AS [Comment]; END END; - +END; -------------------------------------------------------------------------------------------------------------------------------- -- Automatic Tuning info subsection -------------------------------------------------------------------------------------------------------------------------------- From b7ce8f4634bb710628ca855cc32ae72f2108b2e0 Mon Sep 17 00:00:00 2001 From: Petar-T Date: Tue, 30 Apr 2019 02:14:54 +0200 Subject: [PATCH 2/3] Index Key lenght change --- BPCheck/Check_BP_Servers.sql | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/BPCheck/Check_BP_Servers.sql b/BPCheck/Check_BP_Servers.sql index b46f1b85..76b6705b 100644 --- a/BPCheck/Check_BP_Servers.sql +++ b/BPCheck/Check_BP_Servers.sql @@ -10491,14 +10491,16 @@ END; -------------------------------------------------------------------------------------------------------------------------------- IF @ptochecks = 1 BEGIN - RAISERROR (N' |-Starting Indexes with large keys (> 900 bytes)', 10, 1) WITH NOWAIT - IF (SELECT COUNT(*) FROM #tblIxs1 WHERE [KeyCols_data_length_bytes] > 900) > 0 + declare @MaxIndSize int=Case when @sqlmajorver >= 13 THEN 1700 else 900 End + declare @MaxIndSizeStr varchar(4)=Cast(@MaxIndSize as varchar(4)) + RAISERROR (N' |-Starting Indexes with large keys (> %s bytes)', 10, 1,@MaxIndSizeStr) WITH NOWAIT + IF (SELECT COUNT(*) FROM #tblIxs1 WHERE [KeyCols_data_length_bytes] > @MaxIndSize) > 0 BEGIN SELECT 'Index_and_Stats_checks' AS [Category], 'Large_Index_Key' AS [Check], '[WARNING: Some indexes have keys larger than 900 bytes. It is recommended to revise these]' AS [Deviation] SELECT 'Index_and_Stats_checks' AS [Category], 'Large_Index_Key' AS [Information], I.[DatabaseName] AS [Database_Name], I.schemaName AS [Schema_Name], I.[objectName] AS [Table_Name], I.[indexID], I.[indexName] AS [Index_Name], I.KeyCols, [KeyCols_data_length_bytes] FROM #tblIxs1 I - WHERE [KeyCols_data_length_bytes] > 900 + WHERE [KeyCols_data_length_bytes] > @MaxIndSize ORDER BY I.[DatabaseName], I.schemaName, I.[objectName], I.[indexID] END ELSE From 8658bee9375383076d13a7b0d8e020a451167820 Mon Sep 17 00:00:00 2001 From: Petar-T Date: Tue, 30 Apr 2019 02:35:10 +0200 Subject: [PATCH 3/3] small fix --- BPCheck/Check_BP_Servers.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BPCheck/Check_BP_Servers.sql b/BPCheck/Check_BP_Servers.sql index 76b6705b..0894b3db 100644 --- a/BPCheck/Check_BP_Servers.sql +++ b/BPCheck/Check_BP_Servers.sql @@ -10496,7 +10496,7 @@ BEGIN RAISERROR (N' |-Starting Indexes with large keys (> %s bytes)', 10, 1,@MaxIndSizeStr) WITH NOWAIT IF (SELECT COUNT(*) FROM #tblIxs1 WHERE [KeyCols_data_length_bytes] > @MaxIndSize) > 0 BEGIN - SELECT 'Index_and_Stats_checks' AS [Category], 'Large_Index_Key' AS [Check], '[WARNING: Some indexes have keys larger than 900 bytes. It is recommended to revise these]' AS [Deviation] + SELECT 'Index_and_Stats_checks' AS [Category], 'Large_Index_Key' AS [Check], '[WARNING: Some indexes have keys larger than ' + @MaxIndSizeStr + ' bytes. It is recommended to revise these]' AS [Deviation] SELECT 'Index_and_Stats_checks' AS [Category], 'Large_Index_Key' AS [Information], I.[DatabaseName] AS [Database_Name], I.schemaName AS [Schema_Name], I.[objectName] AS [Table_Name], I.[indexID], I.[indexName] AS [Index_Name], I.KeyCols, [KeyCols_data_length_bytes] FROM #tblIxs1 I