The SQL Server query optimizer can find interesting ways to tackle seemingly simple operations that can be hard to optimize. Consider the following query on a table with two indexes, one on (a), the other on (b):
SELECT a, b FROM #data WHERE a<=10 OR b<=10000;The basic problem is that we would really want to use both indexes in a single query.
We get to see a few different versions of the query as well as the execution plans which result.