Any idea why the filter limiting to 5K instead of 320K rows is done at the end ?

Bascialy the filter is correct as it limits to 5K rows the 320K rows available but as ity's don at the end instead of doing it at the begining of the process, SQL SERVER manipulates 320K rows including nvarchar fields and needs more than one GB of ram to do that

Plan.queryanalysis (55.9 kB)
avatar image By jdt 1 asked Mar 21, 2014 at 09:40 AM
more ▼
(comments are locked)
10|10000 characters needed characters left

1 answer: sort voted first

It's hard to know what the predicate "ScalarString12" is in an anonymized plan. Generally, the query optimizer is good at pushing predicates as far down the tree as possible - I can only imagine it has a good reason not to do that here. Perhaps the predicate references a result from the right outer join? Provide better problem information if you can, and I'll look at providing a more useful answer :)

avatar image By SQLkiwi ♦ 6.6k answered Mar 22, 2014 at 12:20 AM
more ▼
(comments are locked)
10|10000 characters needed characters left
Your answer
toggle preview:

Up to 50 attachments (including images) can be used with a maximum of 209.7 MB each and 209.7 MB total.