From 077d31246b84368f579a01e68f4c591417f881be Mon Sep 17 00:00:00 2001 From: Goran Schwarz Date: Mon, 28 Oct 2024 18:35:35 +0100 Subject: [PATCH 1/2] in "qp-node" Added: "Time: #### s" when the element: "s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualElapsedms" exists in "qp-node" Added: "A={$ActualRows} of E={$EstimateRows} (###%)" when the element "s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualRows" exists in "qp-node" When it's a "Eager Index Spool" -- Added class "qp-node-label-2-warning", which for the moment is in color red (to "warn" about this operator, so it stands out a bit... Possibly we want to create an index here...) Added: Normal HTML Tooltip (
) on missing indexes (in some cases the text is truncated... But the tooltip will show them, so you do not have to copy past the rows) --- css/qp.css | 15 +++++++++++++++ src/qp.xslt | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/css/qp.css b/css/qp.css index db006a8..ee2f7ce 100644 --- a/css/qp.css +++ b/css/qp.css @@ -5,6 +5,21 @@ border: 1px solid black; } +div.qp-node-label-cost { +} + +div.qp-node-label-time { + color: orange; +} + +div.qp-node-label-cardinality { + color: gray; +} + +div.qp-node-label-2-warning { + color: red; +} + div.qp-node, div.qp-tt { font-size: 11px; diff --git a/src/qp.xslt b/src/qp.xslt index eb50e0d..d54eec3 100644 --- a/src/qp.xslt +++ b/src/qp.xslt @@ -36,7 +36,12 @@
-
Missing Index (Impact ):
+
+ + + + Missing Index (Impact ): +
@@ -67,6 +72,8 @@
+ +
@@ -412,14 +419,40 @@ -
Cost:
+
Cost:
-
Cost: 0%
+
Cost: 0%
+
+ + + + + + + + + + + + + + +
Time: s
+
+
+ + + + + + +
A= of
E= ()
+
-
()
+ + +
()
+
+ +
()
+
+
From b4051a38e18e064f92ce7edad80727a514c997b4 Mon Sep 17 00:00:00 2001 From: Goran Schwarz Date: Mon, 16 Dec 2024 18:27:54 +0100 Subject: [PATCH 2/2] Some additional changes * Added 'MissingIndexForEagerIndexSpool' in the Missing index section -- That is if we have any "Eager Index Spool", then extract what a good index would look like for that... * Added 'NodeId' at the top right corner of each operator * In the base operator 'left most'. * Added "NonParallelPlanReason" in the tooltip section. * Added Timings for "ElapedTime", "CpuTime", "UdfElapsedTime" & "UdfCpuTime" * Top 10 Waits for the statement are printed in a table sorder by WaitTimeMs * Parameters Compile and Runtime are printed in a table * In any operator * Added "CardinalityPct" and if the estimate and actual are 'way off', it will be printed with a red background --- css/qp.css | 55 ++++++++++++++++++- src/qp.xslt | 154 +++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 200 insertions(+), 9 deletions(-) diff --git a/css/qp.css b/css/qp.css index ee2f7ce..0af2d23 100644 --- a/css/qp.css +++ b/css/qp.css @@ -16,16 +16,39 @@ div.qp-node-label-cardinality { color: gray; } -div.qp-node-label-2-warning { +span.qp-node-label-cardinality-waring { color: red; } +div.qp-node-label-2-warning { + background: red; +} + +div.qp-node-id { + display: none; + color: gray; + position: absolute; + top: 0; + right: 0; + padding-top: 3px; + padding-right: 5px; +} + div.qp-node, div.qp-tt { font-size: 11px; line-height: normal; } +/* +div.qp-node:hover div.qp-node-id { + display: block; +} +*/ +div.qp-tr:hover div.qp-node-id { + display: block; +} + .qp-statement-header { border-color: black; border-style: solid; @@ -107,9 +130,37 @@ div[class|='qp-icon'] { text-align: left; } -.qp-bold, +.qp-tt-warning-important { + color: red; +} + +.qp-tt-wait td { + text-align: left; + padding-left: 2px; +} + +.qp-tt-wait th { + text-align: left; +} + +.qp-tt-params td { + text-align: left; + padding-left: 2px; +} + +.qp-tt-params th { + text-align: left; +} + .qp-tt-header { font-weight: bold; + margin-bottom: 1px; +} + +.qp-bold { + font-weight: bold; + margin-top: 7px; + margin-bottom: 1px; } .qp-tt-header { diff --git a/src/qp.xslt b/src/qp.xslt index d54eec3..e8a8caa 100644 --- a/src/qp.xslt +++ b/src/qp.xslt @@ -27,9 +27,15 @@
-
+
+ + + + +
+
@@ -48,14 +54,66 @@ CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>] ON . ( - , + , ) INCLUDE ( - , + , ) + -- WITH (SORT_IN_TEMPDB=ON, DATA_COMPRESSION=PAGE) - + + + + +
+ + + + + + + + + + + + + + + + + Found "Eager Index Spool", at nodeId= + + : + CREATE NONCLUSTERED INDEX <Name of Missing Index> ON + + . + + ( + + + , + + ) + + + + INCLUDE ( + + + , + + ) + + + -- WITH (SORT_IN_TEMPDB=ON, DATA_COMPRESSION=PAGE) + +
+
+ + +
@@ -69,6 +127,7 @@ +
@@ -322,6 +381,11 @@
+ + Non Parallel Plan Reason + + + @@ -446,12 +510,49 @@ + + + + + + + +
+ Time: s +
+ CPU Time: s +
+ + UDF Time: s +
+
+ + UDF CPU Time: s +
+
+
+
+
+ -
A= of
E= ()
+ +
+ A= of +
+ E= + + + + + qp-node-label-cardinality-waring + + () + +
@@ -540,7 +641,7 @@ Seek Predicates Tooltip --> - +
Seek Predicates
@@ -570,7 +671,8 @@
Columns With No Statistics:
-
The query had to wait seconds for during execution.
+
The query had to wait seconds for during execution.
+
Type conversion in expression () may affect "" in query plan choice.
@@ -586,8 +688,46 @@
+ + + +
Top 10 Waits
+
+ + + + + + + + + + + + + +
Type Ms Count Ms/Count
+
+
+ + + +
Compile and Runtime Parameters
+
+ + + + + + + + +
Name DataType Compiled Value Runtime Value
+
+
+ Seek Keys[]: