4 ms·
> What seems to be suspicious SQL (the CASE/WHEN/ELSE) is probably not the problem. It certainly could be the problem. Like you say, a CASE becomes a computed
by dmethvin 15y ago
> What seems to be suspicious SQL (the CASE/WHEN/ELSE) is probably not the problem.
It certainly could be the problem. Like you say, a CASE becomes a computed field and requires a table scan. A simple check for IsAlsoAFruit can be done with an index scan, assuming it has that index. This can be a huge difference in data scanning and memory load. Of course, there are also plenty of times when SQL will spurn a boolean index because it's not selective enough.