Im utilizing SQL server 2017 and I’ve a question which does a choose and joins from just a few tables. After I take a look at the question plan I discover that the SELECT CASE WHEN a part of the question is performing an index scan and its getting again one row however having to iterate by way of many extra. Has anybody come throughout this situation? Not been capable of get it to carry out an index search. Primarily I search for an account however this account could possibly be in lots of providers and subsequently the SELECT CASE WHEN is to undergo this and get me again the appropriate ones. As a consequence of this its additionally granting extra reminiscence than it must. Planning to run this many occasions so it may not be a problem now however as I run it extra it’s going to change into an issue.
Please can anybody shed some gentle on my errors / understanding?
Statistics are all updated.
Instance snip from my question. The myview is mainly a choose with just a few of the columns from the desk.
SELECT CASE WHEN AC.PBAid = 9 THEN ac.oaID
END as AID,
ac.oaID as aaID
from myview ac