Coder Social home page Coder Social logo

Comments (5)

erikdarlingdata avatar erikdarlingdata commented on May 18, 2024

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.

micke314 avatar micke314 commented on May 18, 2024

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.

erikdarlingdata avatar erikdarlingdata commented on May 18, 2024

Oh wow, that's badass! Thanks. I wonder if I could use that in sp_BlitzLock too.

from darlingdata.

micke314 avatar micke314 commented on May 18, 2024

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.

erikdarlingdata avatar erikdarlingdata commented on May 18, 2024

@micke314 works awesome! Thank you!

from darlingdata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.