Subject RE: [firebird-support] Index Question
Author Alan McDonald
> The software I develop books dates. So I am constantly querying for date
> ranges. Obviously the newest dates are going to be queried more often then
> older dates as time progresses; however, These queries are always ordered
> from oldest to newest.
>
> My questions is this. Should I use descending indexes because I am usually
> querying off the tail end of the data more often or should I use ascending
> indexes because I'm always ordering from oldest to newest or are
> these issue
> even intertwined. How would the indexes work under these conditions.
>
> Thanks
>

I would guess this - your select says WHERE datefield>x and datefield<y
ORDER by datefield desc
So, to locate the records in question you need EITHER am asc or a desc index
but to order them desc, it's best to have a desc index so conclusion
use a desc index for this select, an asc will not add any performance gain.
But to check this, issue the command and look at the plan and statistics of
the select, then change indexes and see if it makes any difference
Alan