From 8e7f03400406e6f2c522f269137ee82d93dd8444 Mon Sep 17 00:00:00 2001 From: anziob Date: Thu, 12 Jun 2025 11:29:53 +0200 Subject: [PATCH] add option ignore_dup_key to global temp table --- Install-All-Scripts.sql | 2 +- sp_BlitzFirst.sql | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Install-All-Scripts.sql b/Install-All-Scripts.sql index d79c67350..324234c4d 100644 --- a/Install-All-Scripts.sql +++ b/Install-All-Scripts.sql @@ -35655,7 +35655,7 @@ BEGIN /* We reuse this one by default rather than recreate it every time. */ CREATE TABLE ##WaitCategories ( - WaitType NVARCHAR(60) PRIMARY KEY CLUSTERED, + WaitType NVARCHAR(60) PRIMARY KEY CLUSTERED with(ignore_dup_key=on), WaitCategory NVARCHAR(128) NOT NULL, Ignorable BIT DEFAULT 0 ); diff --git a/sp_BlitzFirst.sql b/sp_BlitzFirst.sql index e32fa33f6..5e9a819d3 100644 --- a/sp_BlitzFirst.sql +++ b/sp_BlitzFirst.sql @@ -39,7 +39,8 @@ ALTER PROCEDURE [dbo].[sp_BlitzFirst] @Debug BIT = 0, @Version VARCHAR(30) = NULL OUTPUT, @VersionDate DATETIME = NULL OUTPUT, - @VersionCheckMode BIT = 0 + @VersionCheckMode BIT = 0, + @CheckStatisticsUpdatedRecently bit = 0 WITH EXECUTE AS CALLER, RECOMPILE AS BEGIN @@ -512,7 +513,7 @@ BEGIN /* We reuse this one by default rather than recreate it every time. */ CREATE TABLE ##WaitCategories ( - WaitType NVARCHAR(60) PRIMARY KEY CLUSTERED, + WaitType NVARCHAR(60) PRIMARY KEY CLUSTERED with(ignore_dup_key=on), WaitCategory NVARCHAR(128) NOT NULL, Ignorable BIT DEFAULT 0 ); @@ -2478,6 +2479,8 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, END; /* IF @Seconds < 30 */ + if @CheckStatisticsUpdatedRecently = 1 + begin /* Query Problems - Statistics Updated Recently - CheckID 44 */ IF (@Debug = 1) BEGIN @@ -2586,6 +2589,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, FOR XML PATH('')); END + end /* Potential Upcoming Problems - High Number of Connections - CheckID 49 */ IF (@Debug = 1)