Ver código fonte

v2.4

Improved displayed information in missing index check (Thanks Petar Trbos);
Added row count information on empty tables and tables without CL (Thanks Petar Trbos);
Disabled unsupported high VLF fix for Azure SQL Database Managed Instance (Thanks Jovan Popovic);
Improved MaxDOP section to account for new, soon to be Microosft's official documented recommendations.
pmasl 6 anos atrás
pai
commit
4e637b8ab3
2 arquivos alterados com 27 adições e 10 exclusões
  1. 5 1
      BPCheck/Changelog.txt
  2. 22 9
      BPCheck/Check_BP_Servers.sql

+ 5 - 1
BPCheck/Changelog.txt

@@ -356,4 +356,8 @@ v2.2.3.6 - 03/20/2019 - Added several community updates (Thanks Aleksei Guzev an
 						Removed change log from code;
 						Refactored as Stored Procedure (Thanks Jovan Popovic).
 v2.2.3.7 - 03/27/2019 - Fixed bug in HA section with Azure SQL DB Managed Instance (Thanks Jovan Popovic);
-						Fixed MaxDOP section to account for new (soon to be documented) recommendations.
+						Fixed MaxDOP section to account for new (soon to be documented) recommendations.
+v2.4 - 03/31/2019 - Improved displayed information in missing index check (Thanks Petar Trbos);
+						Added row count information on empty tables and tables without CL (Thanks Petar Trbos);
+						Disabled unsupported high VLF fix for Azure SQL Database Managed Instance (Thanks Jovan Popovic);
+						Improved MaxDOP section to account for new, soon to be Microosft's official documented recommendations.

+ 22 - 9
BPCheck/Check_BP_Servers.sql

@@ -1613,6 +1613,16 @@ WHERE is_read_only = 0 AND [state] = 0 AND [dbid] > 4 AND is_distributor = 0
 
 	SELECT @sqlcmd = 'DELETE FROM #tmpdbs1 WHERE [dbid] NOT IN (' + REPLACE(@dbScope,' ','') + ')'
 	EXEC sp_executesql @sqlcmd;
+END 
+ELSE 
+BEGIN 
+	SELECT @sqlcmd = 'SELECT [dbid], [dbname]  
+FROM #tmpdbs0 (NOLOCK)  
+WHERE is_read_only = 0 AND [state] = 0 AND [dbid] > 4 AND is_distributor = 0 
+	AND [role] <> 2 AND (secondary_role_allow_connections <> 0 OR secondary_role_allow_connections IS NULL)' 
+
+	INSERT INTO #tmpdbs_userchoice ([dbid], [dbname]) 
+	EXEC sp_executesql @sqlcmd;
 END;
 
 --------------------------------------------------------------------------------------------------------------------------------
@@ -1645,21 +1655,24 @@ SELECT @affined_cpus = COUNT(cpu_id) FROM sys.dm_os_schedulers WHERE is_online =
 --SELECT @cpucount = COUNT(cpu_id) FROM sys.dm_os_schedulers WHERE scheduler_id < 255 AND parent_node_id < 64
 SELECT 'Processor_checks' AS [Category], 'Parallelism_MaxDOP' AS [Check],
 	CASE WHEN [value] > @affined_cpus THEN '[WARNING: MaxDOP setting exceeds available processor count (affinity)]'
-		WHEN @numa = 1 AND @affined_cpus > 8 AND ([value] = 0 OR [value] > 8) THEN '[WARNING: MaxDOP setting is not recommended for current processor count (affinity)]'
-		WHEN @numa > 1 AND (@cpucount/@numa)/8 <= 2 AND ([value] = 0 OR [value] > (@cpucount/@numa)) THEN '[WARNING: MaxDOP setting is not recommended for current NUMA node to processor count (affinity) ratio]'
-		WHEN @numa > 1 AND (@cpucount/@numa)/8 > 2 AND ([value] = 0 OR [value] > (@cpucount/@numa)/2) THEN '[WARNING: MaxDOP setting is not recommended for current NUMA node to processor count (affinity) ratio]'
+		WHEN @numa = 1 AND @affined_cpus > 8 AND @affined_cpus <= 16 AND ([value] = 0 OR [value] < 8 OR [value] > 16) THEN '[WARNING: MaxDOP setting is not recommended for current processor count (affinity)]'
+		WHEN @numa = 1 AND @affined_cpus > 16 AND ([value] = 0 OR [value] > 16) THEN '[WARNING: MaxDOP setting is not recommended for current processor count (affinity)]'
+		WHEN @numa > 1 AND (@cpucount/@numa) <= 16 AND ([value] = 0 OR [value] > CEILING(@cpucount/@numa)) THEN '[WARNING: MaxDOP setting is not recommended for current NUMA node to processor count (affinity) ratio]'
+		WHEN @numa > 1 AND (@cpucount/@numa) > 16 AND ([value] = 0 OR [value] > CEILING(@cpucount/@numa)/2) THEN '[WARNING: MaxDOP setting is not recommended for current NUMA node to processor count (affinity) ratio]'
 		ELSE '[OK]'
 	END AS [Deviation]
 FROM sys.configurations (NOLOCK) WHERE name = 'max degree of parallelism';
 
 SELECT 'Processor_checks' AS [Category], 'Parallelism_MaxDOP' AS [Information], 
-	CASE WHEN [value] > @affined_cpus THEN @affined_cpus
-		-- If not NUMA, then MaxDOP = 8
-		WHEN @numa = 1 AND @affined_cpus > 8 AND ([value] = 0 OR [value] > 8) THEN 8
-		-- If NUMA and # logical CPUs per NUMA up to 16, then MaxDOP is set as # logical CPUs per NUMA, up to 8 
-		WHEN @numa > 1 AND (@cpucount/@numa)/8 <= 2 AND ([value] = 0 OR [value] > (@cpucount/@numa)) THEN @cpucount/@numa
+	CASE 
+		-- If not NUMA, and up to 16 @affined_cpus then MaxDOP up to 16
+		WHEN @numa = 1 AND @affined_cpus > 8 AND @affined_cpus <= 16 AND ([value] = 0 OR [value] < 8 OR [value] >= 16) THEN @affined_cpus
+		-- If not NUMA, and more than 16 @affined_cpus then MaxDOP 16
+		WHEN @numa = 1 AND @affined_cpus > 16 AND ([value] = 0 OR [value] > 16) THEN 16
+		-- If NUMA and # logical CPUs per NUMA up to 16, then MaxDOP is set as # logical CPUs per NUMA, up to 16 
+		WHEN @numa > 1 AND (@cpucount/@numa) <= 16 AND ([value] = 0 OR [value] > (@cpucount/@numa)) THEN CEILING(@cpucount/@numa)
 		-- If NUMA and # logical CPUs per NUMA > 16, then MaxDOP is set as 1/2 of # logical CPUs per NUMA
-		WHEN @numa > 1 AND (@cpucount/@numa)/8 > 2 AND ([value] = 0 OR [value] > (@cpucount/@numa)/2) THEN (@cpucount/@numa)/2
+		WHEN @numa > 1 AND (@cpucount/@numa) > 16 AND ([value] = 0 OR [value] > CEILING((@cpucount/@numa)/2)) THEN CEILING((@cpucount/@numa)/2)
 		ELSE 0
 	END AS [Recommended_MaxDOP],
 	[value] AS [Current_MaxDOP], @cpucount AS [Available_Processors], @affined_cpus AS [Affined_Processors],