This is an old revision of the document!
Ordering is usually optimized by creating an index containing all of the columns in the ORDER BY clause. The order of the column in the index must match the order of the columns in the ORDER BY clause. At present, only ascending ORDER BY clauses are optimized.
In this example, the ORDER BY clause is optimized using the same index used for processing criteria.
select NAME, ADDRESS1, ADDRESS2, PHONE
from INDIVIDUALS
where STATE in ('CA','CO') and NAME = 'John'
order by STATE
The STATE index will be used to satisfy both the criteria and the ORDER BY clause.
In this example, the ORDER BY clause will be optimized with a multi-column index.
select NAME, ADDRESS1, ADDRESS2, PHONE
from INDIVIDUALS
where STATE in ('CA','CO') and NAME = 'John'
order by STATE, CITY
A multi-column Omnidex index containing STATE and CITY, in that order, will optimize this ORDER BY clause.
See also: