sql-server add tag
7 years ago reluctant and angry dba (imported from SE)

My boss wants me to parse a set of query plans stored in a table and to determine how many nested loop operators with unordered prefetching are present in each plan. I only have around 100 query plans so performance isn’t very important. I tried doing it myself but quickly got confused and couldn’t make progress.

The structure of the table:

I uploaded T-SQL to add three example query plans to the table on pastebin. This is the output that I’m looking for:

I can’t answer any questions as to why I need to do this. Thanks!

Top Answer
7 years ago meme (imported from SE)

This will Work Perfectly®

If you prefer, you could use

…and omit the namespace prefix p: from the XQuery expression.

This room is for discussion about this question.

Once logged in you can direct comments to any contributor here.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.