News for hackers. Stuff that matters.
Re:ORMs don’t kill databases. Developers do. by dmethvin on Tuesday August 30, 2011 @10:33AM (#2941588)
> 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.

There are no comments on this comment yet.