where clause defines the search condition of an SQL statement, and it thus falls into the core functional domain of an index: finding data quickly. Although the
where clause has a huge impact on performance, it is often phrased carelessly so that the database has to scan a large part of the index. The result: a poorly written
where clause is the first ingredient of a slow query.
This chapter explains how different operators affect index usage and how to make sure that an index is usable for as many queries as possible. The last section shows common anti-patterns and presents alternatives that deliver better performance.