Skip to content

Commit 4e8659e

Browse files
committed
Small optimization
Don't need to pull QueryHash, so taking it out and using SqlHandle for the window function instead.
1 parent b32f7a5 commit 4e8659e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

sp_BlitzCache.sql

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,16 +1611,14 @@ OPTION (RECOMPILE);
16111611
SELECT
16121612
statement.value('sum(/p:StmtSimple/@StatementSubTreeCost)', 'float') AS SubTreeCost,
16131613
s.PlanHandle,
1614-
s.SqlHandle,
1615-
s.QueryHash
1614+
s.SqlHandle
16161615
FROM #statements AS s
16171616
WHERE PlanHandle IS NOT NULL
16181617
)
16191618
, QueryCostUpdate AS (
16201619
SELECT
1621-
SUM(qc.SubTreeCost) OVER (PARTITION BY QueryHash, PlanHandle) PlanTotalQuery,
1620+
SUM(qc.SubTreeCost) OVER (PARTITION BY SqlHandle, PlanHandle) PlanTotalQuery,
16221621
qc.PlanHandle,
1623-
qc.QueryHash,
16241622
qc.SqlHandle
16251623
FROM QueryCost qc
16261624
WHERE qc.SubTreeCost > 0

0 commit comments

Comments
 (0)