Comments (5)
Just to make sure I fully understand: what's the advantage of assigning the XML to a variable up front, and then shredding? Does something weird happen in the DMV query that could lead to extra XML-shredding before the target_name
filter is applied?
from darlingdata.
You mean instead of shredding on the value converted to xml from nvarchar(max) in the DMV. That is blogged about here.
https://www.sql.kiwi/2012/09/compute-scalars-expressions-and-execution-plan-performance.html
The cast to XML is deferred to where ever the query needs the XML, for each row, for each value and when the cast is done the XML is validated over and over again.
So by casting to a variable the cast happens only once.
from darlingdata.
Oh wow, that's badass! Thanks. I wonder if I could use that in sp_BlitzLock too.
from darlingdata.
It does not of course have to be a variable to fix this, it could as well have been to a temp table with an XML column.
You will have the exact same issue if you shred queryplans from the query store.
Dump the querystore to a temp table with an XML column and shred the temp table instead.
Will probably be much faster.
from darlingdata.
@micke314 works awesome! Thank you!
from darlingdata.
Related Issues (20)
- Add the ability to return queries only from procedures/functions; Display summary resource usage data by procedure/function HOT 1
- sp_QuickieStore - Adjust for UTC Timestamps Used in Query Store HOT 4
- Make block viewer go faster
- Block Viewer plans
- Querying WhoIsActive-table returns an error in SSMS HOT 1
- Sorting sp_QuickieStore output by total CPU instead of average CPU HOT 1
- Notes from Canada HOT 1
- Msg 105 Unclosed quotation mark after the character string '(data[@name="is_recompi'. HOT 6
- Syntax Error in the script HOT 1
- sp_HealthParser: Add xml deadlock report section
- sp_QuickieStore not returning expected runtime_stats records HOT 6
- sp_QuickieStore unexpected default @end_date HOT 4
- sp_QuickieStore - Count of executions across all plan ids? HOT 2
- sp_PressureDetector: configurable CPU percent details
- sp_HumanEventsBlockViewer: Add object schema to contentious object
- Given @days_back is always negative then this would always return @days_back HOT 1
- sp_HumanEventsBlockViewer - check if databases already have RCSI enabled in sys.databases
- sp_HumanEvents: logging the one-off runs to table HOT 5
- sp_LogHunter: Add search for CAL warning
- Log_Hunter additional parameters for not delete record HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from darlingdata.