Think about index order

Derby allows you to create index columns in descending order in addition
to creating them in ascending order, the default. Descending indexes provide
performance benefits for the following kinds of queries that require sorting data in descending order.

To ensure performance benefits, verify that the descending index is being
used. See Analyzing statement execution for
information on how to do this.