Skip to content

Commit 3129760

Browse files
Update diagnostic queries and module version
Refreshed SQL Server diagnostic query scripts for 2014, 2016, 2017, 2019, 2022, and 2025 with new build references, metadata, and improved scalar UDF in-lineability queries. Updated dbatools.psd1 to version 2.7.7 and required dbatools.library to 2025.11.12.
1 parent 14838a7 commit 3129760

9 files changed

+36
-24
lines changed

bin/dbatools-index.json

214 KB
Binary file not shown.

bin/diagnosticquery/SQLServerDiagnosticQueries_2014.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
-- SQL Server 2014 Diagnostic Information Queries
33
-- Glenn Berry
4-
-- Last Modified: August 4, 2025
4+
-- Last Modified: November 3, 2025
55
-- https://glennsqlperformance.com/
66
-- https://sqlserverperformance.wordpress.com/
77
-- YouTube: https://bit.ly/2PkoAM1

bin/diagnosticquery/SQLServerDiagnosticQueries_2016SP1.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
-- SQL Server 2016 Diagnostic Information Queries
33
-- Glenn Berry
4-
-- Last Modified: August 4, 2025
4+
-- Last Modified: November 3, 2025
55
-- https://glennsqlperformance.com/
66
-- https://sqlserverperformance.wordpress.com/
77
-- YouTube: https://bit.ly/2PkoAM1

bin/diagnosticquery/SQLServerDiagnosticQueries_2016SP2.sql

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
-- SQL Server 2016 SP2 Diagnostic Information Queries
33
-- Glenn Berry
4-
-- Last Modified: September 10, 2025
4+
-- Last Modified: November 11, 2025
55
-- https://glennsqlperformance.com/
66
-- https://sqlserverperformance.wordpress.com/
77
-- YouTube: https://bit.ly/2PkoAM1
@@ -89,6 +89,8 @@ SELECT @@SERVERNAME AS [Server Name], @@VERSION AS [SQL Server and OS Version In
8989
-- 13.0.5865.1 SP2 CU15 + Security Update 1/12/2021 https://support.microsoft.com/en-us/help/4583461/kb4583461-security-update-for-sql-server-2016-sp2-cu15
9090
-- 13.0.5882.1 SP2 CU16 2/11/2021 https://support.microsoft.com/en-us/office/kb5000645-cumulative-update-16-for-sql-server-2016-sp2-a3997fa9-ec49-4df0-bcc3-12dd58b78265
9191
-- 13.0.5888.11 SP2 CU17 3/29/2021 https://support.microsoft.com/en-us/topic/kb5001092-cumulative-update-17-for-sql-server-2016-sp2-5876a4d6-59ac-484a-93dc-4be456cd87d1
92+
-- 13.0.5893.48 CU17 + GDR 6/14/2022 https://support.microsoft.com/en-us/topic/kb5014351-description-of-the-security-update-for-sql-server-2016-sp2-cu17-june-14-2022-d30a69f4-1a72-41b2-a545-6a211b5fc0f7
93+
9294

9395

9496
-- SP3 Builds
@@ -102,7 +104,8 @@ SELECT @@SERVERNAME AS [Server Name], @@VERSION AS [SQL Server and OS Version In
102104
-- 13.0.6450.1 SP3 + GDR 10/8/2024 https://support.microsoft.com/en-us/topic/kb5046063-description-of-the-security-update-for-sql-server-2016-sp3-gdr-october-8-2024-87f6091b-a0c0-48e7-8de4-b10381559ba7
103105
-- 13.0.6455.2 SP3 + GDR 11/12/2024 https://support.microsoft.com/en-us/topic/kb5046855-description-of-the-security-update-for-sql-server-2016-sp3-gdr-november-12-2024-736b0a32-912d-4ea5-baf8-50d046cbfa1a
104106
-- 13.0.6465.1 SP3 + GDR 8/12/2025 https://support.microsoft.com/en-us/topic/kb5063762-description-of-the-security-update-for-sql-server-2016-sp3-gdr-august-12-2025-c7c25df6-577c-49b3-9ca9-b7e9812b9344
105-
-- 13.0.6470.1 SP3 + GDR 9/11/2025 https://support.microsoft.com/en-us/topic/kb5065226-description-of-the-security-update-for-sql-server-2016-sp3-gdr-september-9-2025-7cf66f6b-dda8-47e1-bcb2-2f4630e5c48a
107+
-- 13.0.6470.1 SP3 + GDR 9/9/2025 https://support.microsoft.com/en-us/topic/kb5065226-description-of-the-security-update-for-sql-server-2016-sp3-gdr-september-9-2025-7cf66f6b-dda8-47e1-bcb2-2f4630e5c48a
108+
-- 13.0.6475.1 SP3 + GDR 11/11/2025 https://support.microsoft.com/en-us/topic/kb5068401-description-of-the-security-update-for-sql-server-2016-sp3-gdr-november-11-2025-59a59fc0-f673-45c2-b8de-492b95c0e423
106109

107110

108111
-- Azure Connect Pack Builds
@@ -116,6 +119,7 @@ SELECT @@SERVERNAME AS [Server Name], @@VERSION AS [SQL Server and OS Version In
116119
-- 13.0.7050.2 Azure Connect Pack + GDR 11/12/2024 https://support.microsoft.com/en-us/topic/kb5046856-description-of-the-security-update-for-sql-server-2016-sp3-azure-connect-feature-pack-november-12-2024-b180cac0-187e-48eb-b6c6-3d48d0a00902
117120
-- 13.0.7060.1 Azure Connect Pack + GDR 8/12/2025 https://support.microsoft.com/en-us/topic/kb5063761-description-of-the-security-update-for-sql-server-2016-sp3-azure-connect-feature-pack-august-12-2025-78088dab-76e7-4a0d-8392-9ebb3f7dfefe
118121
-- 13.0.7065.1 Azure Connect Pack + GDR 9/9/2025 https://support.microsoft.com/en-us/topic/kb5065227-description-of-the-security-update-for-sql-server-2016-sp3-azure-connect-feature-pack-september-9-2025-d8b13d39-30cc-4a82-9382-0ecf1b2ff118
122+
-- 13.0.7070.1 Azure Connect Pack + GDR 11/11/2025 https://support.microsoft.com/en-us/topic/kb5068400-description-of-the-security-update-for-sql-server-2016-sp3-azure-connect-feature-pack-november-11-2025-9ea222c4-2d64-4b8d-aaf0-2fae80392540
119123

120124

121125
-- How to determine the version, edition and update level of SQL Server and its components

bin/diagnosticquery/SQLServerDiagnosticQueries_2017.sql

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
-- SQL Server 2017 Diagnostic Information Queries
33
-- Glenn Berry
4-
-- Last Modified: September 10, 2025
4+
-- Last Modified: November 11, 2025
55
-- https://glennsqlperformance.com/
66
-- https://sqlserverperformance.wordpress.com/
77
-- YouTube: https://bit.ly/2PkoAM1
@@ -111,10 +111,13 @@ SELECT @@SERVERNAME AS [Server Name], @@VERSION AS [SQL Server and OS Version In
111111
-- 14.0.3465.1 CU31 + GDR 10/10/2023 https://support.microsoft.com/en-us/topic/kb5029376-description-of-the-security-update-for-sql-server-2017-cu31-october-10-2023-ce23ddf7-b79e-4ba7-ba9d-2679f23a1ad8
112112
-- 14.0.3471.2 CU31 + GDR 7/9/2024 https://support.microsoft.com/en-us/topic/kb5040940-description-of-the-security-update-for-sql-server-2017-cu31-july-9-2024-bff7ab26-e882-4419-aebb-30356125f5c9
113113
-- 14.0.3475.1 CU31 + GDR 9/10/2024 https://support.microsoft.com/en-us/topic/kb5042215-description-of-the-security-update-for-sql-server-2017-cu31-september-10-2024-55bba26f-548d-466c-9c48-edfb51a53a8a
114-
-- 14.0.3480.1 CU31 + GDR 10/8/2024 https://support.microsoft.com/en-us/topic/kb5046061-description-of-the-security-update-for-sql-server-2017-cu31-october-8-2024-af669e75-bc43-4679-bfbe-e153e679dd2f
114+
-- 14.0.3480.1 CU31 + GDR 10/8/2024 https://support.microsoft.com/en-us/topic/kb5046061-description-of-the-security-update-for-sql-server-2017-cu31-october-8-2024-af669e75-bc43-4679-bfbe-e153e679dd2f
115115
-- 14.0.3485.1 CU31 + GDR 11/12/2024 https://support.microsoft.com/en-us/topic/kb5046858-description-of-the-security-update-for-sql-server-2017-cu31-november-12-2024-2984d3a5-0683-4f9b-9e6a-3888e67bd859
116+
-- 14.0.3495.9 CU31 + GDR 7/8/20254 https://support.microsoft.com/en-us/topic/kb5058714-description-of-the-security-update-for-sql-server-2017-cu31-july-8-2025-cdc42d67-b4a1-4e6a-9f7a-11da1e733218
116117
-- 14.0.3500.1 CU31 + GDR 8/12/2025 https://support.microsoft.com/en-us/topic/kb5063759-description-of-the-security-update-for-sql-server-2017-cu31-august-12-2025-7f5dfab6-e32b-4af3-87fe-0e527b5729d3
117118
-- 14.0.3505.1 CU31 + GDR 9/9/2025 https://support.microsoft.com/en-us/topic/kb5065225-description-of-the-security-update-for-sql-server-2017-cu31-september-9-2025-b1addb22-3bfd-4870-b914-c020c2a3d2be
119+
-- 14.0.3515.1 CU31 + GDR 11/11/2025 https://support.microsoft.com/en-us/topic/kb5068402-description-of-the-security-update-for-sql-server-2017-cu31-november-11-2025-1be08efe-ad14-4b95-a0de-ecbbf2703114
120+
118121

119122
-- SQL Server 2017 Azure Connect Pack builds
120123
-- Azure Connect Feature Pack is optional and should be installed only if you intend to connect SQL Server with Azure SQL Managed Instance

bin/diagnosticquery/SQLServerDiagnosticQueries_2019.sql

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
-- SQL Server 2019 Diagnostic Information Queries
33
-- Glenn Berry
4-
-- Last Modified: September 10, 2025
4+
-- Last Modified: November 11, 2025
55
-- https://glennsqlperformance.com/
66
-- https://sqlserverperformance.wordpress.com/
77
-- YouTube: https://bit.ly/2PkoAM1
@@ -113,6 +113,7 @@ SELECT @@SERVERNAME AS [Server Name], @@VERSION AS [SQL Server and OS Version In
113113
-- 15.0.4415.2 CU30 12/12/2024 https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2019/cumulativeupdate30
114114
-- 15.0.4420.2 CU31 2/13/2025 https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2019/cumulativeupdate31
115115
-- 15.0.4430.1 CU32 2/27/2025 https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2019/cumulativeupdate32
116+
-- 15.0.4435.7 CU32 + GDR 7/8/2025 https://support.microsoft.com/en-us/topic/kb5058722-description-of-the-security-update-for-sql-server-2019-cu32-july-8-2025-09dc5da9-3a60-4462-a8ac-a8e782d088d5
116117
-- 15.0.4440.1 CU32 + GDR 8/12/2025 https://support.microsoft.com/en-us/topic/kb5063757-description-of-the-security-update-for-sql-server-2019-cu32-august-12-2025-d4df46ef-6b1e-4a6c-aa8c-914d25f74345
117118
-- 15.0.4445.1 CU32 + GDR 9/9/2025 https://support.microsoft.com/en-us/topic/kb5065222-description-of-the-security-update-for-sql-server-2019-cu32-september-9-2025-152ac456-cb04-4b88-8177-a77fe24ac80d
118119

@@ -2196,12 +2197,13 @@ ORDER BY total_worker_time DESC OPTION (RECOMPILE);
21962197

21972198

21982199
-- Determine which scalar UDFs are in-lineable (Query 82) (Inlineable UDFs)
2199-
SELECT OBJECT_NAME(m.object_id) AS [Function Name], is_inlineable, inline_type,
2200-
efs.total_worker_time
2200+
SELECT OBJECT_NAME(m.object_id) AS [Function Name], m.is_inlineable,
2201+
m.inline_type, m.is_schema_bound, m.null_on_null_input,
2202+
efs.total_worker_time, efs.execution_count, efs.cached_time
22012203
FROM sys.sql_modules AS m WITH (NOLOCK)
22022204
LEFT OUTER JOIN sys.dm_exec_function_stats AS efs WITH (NOLOCK)
22032205
ON m.object_id = efs.object_id
2204-
WHERE efs.type_desc = N'SQL_SCALAR_FUNCTION'
2206+
WHERE efs.[type_desc] = N'SQL_SCALAR_FUNCTION'
22052207
ORDER BY efs.total_worker_time DESC
22062208
OPTION (RECOMPILE);
22072209
------

bin/diagnosticquery/SQLServerDiagnosticQueries_2022.sql

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
-- SQL Server 2022 Diagnostic Information Queries
33
-- Glenn Berry
4-
-- Last Modified: September 11, 2025
4+
-- Last Modified: November 11, 2025
55
-- https://glennsqlperformance.com/
66
-- https://sqlserverperformance.wordpress.com/
77
-- YouTube: https://bit.ly/2PkoAM1
@@ -98,6 +98,7 @@ SELECT @@SERVERNAME AS [Server Name], @@VERSION AS [SQL Server and OS Version In
9898
-- 16.0.4210.1 CU20 + GDR 8/12/2025 https://support.microsoft.com/en-us/topic/kb5063814-description-of-the-security-update-for-sql-server-2022-cu20-august-12-2025-8744624f-a95c-4902-a191-5a25079d7f37
9999
-- 16.0.4212.1 CU20 + GDR 9/9/2025 https://support.microsoft.com/en-us/topic/kb5065220-description-of-the-security-update-for-sql-server-2022-cu20-september-9-2025-e58e6d66-717c-4e33-adc1-4a89d3dd71f5
100100
-- 16.0.4215.2 CU21 9/11/2025 https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2022/cumulativeupdate21
101+
-- 16.0.4222.2 CU21 + GDR 11/11/2025 https://support.microsoft.com/en-us/topic/kb5068406-description-of-the-security-update-for-sql-server-2022-cu21-november-11-2025-7403d389-606b-4176-a1d5-b0960fb7dc50
101102

102103

103104
-- What's new in SQL Server 2022 (16.x)
@@ -2273,12 +2274,13 @@ ORDER BY total_worker_time DESC OPTION (RECOMPILE);
22732274

22742275

22752276
-- Determine which scalar UDFs are in-lineable (Query 84) (Inlineable UDFs)
2276-
SELECT OBJECT_NAME(m.object_id) AS [Function Name], m.is_inlineable, m.inline_type,
2277-
efs.total_worker_time
2277+
SELECT OBJECT_NAME(m.object_id) AS [Function Name], m.is_inlineable,
2278+
m.inline_type, m.is_schema_bound, m.null_on_null_input,
2279+
efs.total_worker_time, efs.execution_count, efs.cached_time
22782280
FROM sys.sql_modules AS m WITH (NOLOCK)
22792281
LEFT OUTER JOIN sys.dm_exec_function_stats AS efs WITH (NOLOCK)
22802282
ON m.object_id = efs.object_id
2281-
WHERE efs.type_desc = N'SQL_SCALAR_FUNCTION'
2283+
WHERE efs.[type_desc] = N'SQL_SCALAR_FUNCTION'
22822284
ORDER BY efs.total_worker_time DESC
22832285
OPTION (RECOMPILE);
22842286
------

bin/diagnosticquery/SQLServerDiagnosticQueries_2025.sql

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
-- SQL Server 2025 Diagnostic Information Queries
33
-- Glenn Berry
4-
-- Last Modified: September 17, 2025
4+
-- Last Modified: November 3, 2025
55
-- https://glennsqlperformance.com/
66
-- https://sqlserverperformance.wordpress.com/
77
-- YouTube: https://bit.ly/2PkoAM1
@@ -656,7 +656,7 @@ IF EXISTS (SELECT * WHERE CONVERT(VARCHAR(2), SERVERPROPERTY('ProductMajorVersio
656656
EXEC sys.xp_readerrorlog 0, 1, N'CPU vectorization level';
657657
DECLARE @CPUVectorizationLevel NVARCHAR(200) = (SELECT LogText FROM #CPUVectorizationLevel);
658658

659-
-- Get TF15097 Status
659+
-- Get TF 15097 Status
660660
DROP TABLE IF EXISTS #TraceFlagStatus;
661661
CREATE TABLE #TraceFlagStatus
662662
(TraceFlag smallint, TFStatus tinyint, TFGlobal tinyint, TFSession tinyint);
@@ -1001,7 +1001,7 @@ WHERE lu.counter_name LIKE N'Log File(s) Used Size (KB)%'
10011001
AND ls.counter_name LIKE N'Log File(s) Size (KB)%'
10021002
AND ds.counter_name LIKE N'Data File(s) Size (KB)%'
10031003
AND ls.cntr_value > 0
1004-
ORDER BY db.[name] OPTION (RECOMPILE);
1004+
ORDER BY db.[name] OPTION (USE HINT ('FORCE_LEGACY_CARDINALITY_ESTIMATION'), LOOP JOIN, RECOMPILE);
10051005
------
10061006

10071007
-- sys.databases (Transact-SQL)
@@ -1499,7 +1499,7 @@ CROSS APPLY sys.dm_exec_query_plan(plan_handle) AS qp
14991499
WHERE cp.cacheobjtype = N'Compiled Plan'
15001500
AND cp.objtype IN (N'Adhoc', N'Prepared')
15011501
AND cp.usecounts = 1
1502-
ORDER BY cp.size_in_bytes DESC, DB_NAME(t.[dbid]) OPTION (RECOMPILE);
1502+
ORDER BY cp.size_in_bytes DESC, DB_NAME(t.[dbid]) OPTION (USE HINT ('FORCE_LEGACY_CARDINALITY_ESTIMATION'), FORCE ORDER, LOOP JOIN);
15031503
------
15041504

15051505
-- Gives you the text, type and size of single-use ad-hoc and prepared queries that waste space in the plan cache
@@ -2232,13 +2232,14 @@ ORDER BY total_worker_time DESC OPTION (RECOMPILE);
22322232
-- https://bit.ly/2q1Q6BM
22332233

22342234

2235-
-- Determine which scalar UDFs are in-lineable (Query 84) (Inlineable UDFs)
2236-
SELECT OBJECT_NAME(m.object_id) AS [Function Name], m.is_inlineable, m.inline_type,
2237-
efs.total_worker_time
2235+
-- Determine which scalar UDFs are in-lineable (Query 84) (Inlineable UDFs)
2236+
SELECT OBJECT_NAME(m.object_id) AS [Function Name], m.is_inlineable,
2237+
m.inline_type, m.is_schema_bound, m.null_on_null_input,
2238+
efs.total_worker_time, efs.execution_count, efs.cached_time
22382239
FROM sys.sql_modules AS m WITH (NOLOCK)
22392240
LEFT OUTER JOIN sys.dm_exec_function_stats AS efs WITH (NOLOCK)
22402241
ON m.object_id = efs.object_id
2241-
WHERE efs.type_desc = N'SQL_SCALAR_FUNCTION'
2242+
WHERE efs.[type_desc] = N'SQL_SCALAR_FUNCTION'
22422243
ORDER BY efs.total_worker_time DESC
22432244
OPTION (RECOMPILE);
22442245
------

dbatools.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
RootModule = 'dbatools.psm1'
1212

1313
# Version number of this module.
14-
ModuleVersion = '2.7.6'
14+
ModuleVersion = '2.7.7'
1515

1616
# ID used to uniquely identify this module
1717
GUID = '9d139310-ce45-41ce-8e8b-d76335aa1789'
@@ -31,7 +31,7 @@
3131
# Modules that must be imported into the global environment prior to importing this module
3232
RequiredModules = @{
3333
ModuleName = 'dbatools.library';
34-
ModuleVersion = '2025.8.17'
34+
ModuleVersion = '2025.11.12'
3535
}
3636

3737
# Assemblies that must be loaded prior to importing this module

0 commit comments

Comments
 (0)