Query Plan says “Just do nothing”
How many times do you ask someone to do something and get the response “I’m not doing that – there’s no point”.
Turns out SQL Server does that sometimes too – as I was reminded recently.
After spending time examining query plans using SentryOne Plan Explorer, I was faced with the following improbable Plan Diagram:
I lost a few minutes thinking about this – it was a quite a complicated Query, so I was expecting something else. Just then, I remembered.
If SQL Server determines that your Query is so badly flawed that it will never return data, then it will not run that Query.
This could be because you have deliberately sabotaged the query (as in the example – using WHERE 0 = 1 has it’s place, but not here), or something more complex that eventually joins to a Table resulting in no possibility of data being returned
Hoping that this will save you a little time and worry, Nigel..