# Decide whether a descending index would be useful

Derby allows you to create an index that uses the descending order for a column. Such indexes improve the performance of queries that order results in descending order or that search for the minimum or maximum value of an indexed column.

For example, both of the following queries could benefit from indexes that use descending ordering:

    -- would benefit from an index like this:
    -- CREATE INDEX c_id_desc ON Cities(city_id DESC)
    SELECT * FROM Cities ORDER BY city_id DESC
    -- would benefit from an index like this:
    -- CREATE INDEX f_miles_desc on Flights(miles DESC)
    SELECT MAX(miles) FROM Flight
    -- would benefit from an index like this:
    -- CREATE INDEX arrival_time_desc ON Flights(dest_airport, arrive_time DESC)
    SELECT * FROM Flights WHERE dest_airport = 'LAX'
    ORDER BY ARRIVAL DESC

Parent topic: Always create indexes
Related concepts
Create useful indexes
Make sure indexes are being used, and rebuild them
Think about index order
Think about join order