Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 580c9b5

Browse files
Merge pull request BrentOzarULTD#1263 from BrentOzarULTD/Issue_1256
Fixed index mod query
2 parents b73d650 + ec2c2bb commit 580c9b5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

‎sp_BlitzCache.sql‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,7 +2646,7 @@ WITH XMLNAMESPACES('http://schemas.microsoft.com/sqlserver/2004/07/showplan' AS
26462646
IndexOps AS
26472647
(
26482648
SELECT
2649-
r.SqlHandle,
2649+
r.QueryHash,
26502650
c.n.value('@PhysicalOp', 'VARCHAR(100)') AS op_name,
26512651
c.n.exist('@PhysicalOp[.="Index Insert"]') AS ii,
26522652
c.n.exist('@PhysicalOp[.="Index Update"]') AS iu,
@@ -2664,7 +2664,7 @@ IndexOps AS
26642664
OUTER APPLY r.relop.nodes('/p:RelOp/p:SimpleUpdate/p:Object') o3(n)
26652665
), iops AS
26662666
(
2667-
SELECT ios.SqlHandle,
2667+
SELECT ios.QueryHash,
26682668
SUM(CONVERT(TINYINT, ios.ii)) AS index_insert_count,
26692669
SUM(CONVERT(TINYINT, ios.iu)) AS index_update_count,
26702670
SUM(CONVERT(TINYINT, ios.id)) AS index_delete_count,
@@ -2678,7 +2678,7 @@ IndexOps AS
26782678
WHERE ios.op_name IN ('Index Insert', 'Index Delete', 'Index Update',
26792679
'Clustered Index Insert', 'Clustered Index Delete', 'Clustered Index Update',
26802680
'Table Insert', 'Table Delete', 'Table Update')
2681-
GROUP BY ios.SqlHandle)
2681+
GROUP BY ios.QueryHash)
26822682
UPDATE b
26832683
SET b.index_insert_count = iops.index_insert_count,
26842684
b.index_update_count = iops.index_update_count,
@@ -2690,7 +2690,7 @@ SET b.index_insert_count = iops.index_insert_count,
26902690
b.table_update_count = iops.table_update_count,
26912691
b.table_delete_count = iops.table_delete_count
26922692
FROM ##bou_BlitzCacheProcs AS b
2693-
JOIN iops ON iops.SqlHandle = b.SqlHandle
2693+
JOIN iops ON iops.QueryHash = b.QueryHash
26942694
WHERE SPID = @@SPID
26952695
OPTION(RECOMPILE);
26962696

‎sp_BlitzQueryStore.sql‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2585,7 +2585,7 @@ WITH XMLNAMESPACES('http://schemas.microsoft.com/sqlserver/2004/07/showplan' AS
25852585
IndexOps AS
25862586
(
25872587
SELECT
2588-
r.sql_handle,
2588+
r.query_hash,
25892589
c.n.value('@PhysicalOp', 'VARCHAR(100)') AS op_name,
25902590
c.n.exist('@PhysicalOp[.="Index Insert"]') AS ii,
25912591
c.n.exist('@PhysicalOp[.="Index Update"]') AS iu,
@@ -2603,7 +2603,7 @@ IndexOps AS
26032603
OUTER APPLY r.relop.nodes('/p:RelOp/p:SimpleUpdate/p:Object') o3(n)
26042604
), iops AS
26052605
(
2606-
SELECT ios.sql_handle,
2606+
SELECT ios.query_hash,
26072607
SUM(CONVERT(TINYINT, ios.ii)) AS index_insert_count,
26082608
SUM(CONVERT(TINYINT, ios.iu)) AS index_update_count,
26092609
SUM(CONVERT(TINYINT, ios.id)) AS index_delete_count,
@@ -2617,7 +2617,7 @@ IndexOps AS
26172617
WHERE ios.op_name IN ('Index Insert', 'Index Delete', 'Index Update',
26182618
'Clustered Index Insert', 'Clustered Index Delete', 'Clustered Index Update',
26192619
'Table Insert', 'Table Delete', 'Table Update')
2620-
GROUP BY ios.sql_handle)
2620+
GROUP BY ios.query_hash)
26212621
UPDATE b
26222622
SET b.index_insert_count = iops.index_insert_count,
26232623
b.index_update_count = iops.index_update_count,
@@ -2629,7 +2629,7 @@ SET b.index_insert_count = iops.index_insert_count,
26292629
b.table_update_count = iops.table_update_count,
26302630
b.table_delete_count = iops.table_delete_count
26312631
FROM #working_warnings AS b
2632-
JOIN iops ON iops.sql_handle = b.sql_handle
2632+
JOIN iops ON iops.query_hash = b.query_hash
26332633
OPTION (RECOMPILE);
26342634

26352635

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /