Previous Topic Next topic Print topic


Expressions

If an indexed column appears in a query only as a part of an expression that alters the column, the index will not be used. For example, given the following query, an index on the PAYRATE column will not be used, even if it exists:

SELECT * FROM employee 
    WHERE payrate * 1.10 > 13.00

Likewise, the index will not be used in the following query:

SELECT * FROM employee 
    WHERE payrate > 13.00/1.10

Usually, it is best to perform the constant calculations prior to executing the query.

Previous Topic Next topic Print topic