Press "Enter" to skip to content

The Downside of CASE Expressions in WHERE Clauses

Erik Darling explains a common performance problem:

Obviously, this extends to join clauses as well. A case expression there has just as much chance of causing performance issues.

This pattern crops up in some ORM queries that I’ve seen as well, but I haven’t been able to figure out the code that causes it.

Let’s look at why this causes problems!

Let us, shall we?