Subject Re: [firebird-support] Re: How to mix ascending and descending fields in one index
Author Aage Johansen
kokok_kokok wrote:
>
> If the index is (a,b) then
>
> "select * from foo order by a, b" uses the index in the plan, but
what I need is:
>
> "select * from foo order by a desc, b"
>
>
> How can I create a index to be used in the above sql statement?
>

Did you try "select * from FOO order by A, B" with and without
index? Did you notice any difference?
There's problably nothing to gain by using an index for sorting -
rather something to lose.
You'll need to read all the records, and the fastest way to do this
is to let Firebird use "natural" (and sort afterwards).
As Martijn wrote: use indexes for filtering records, not for ordering.

--
Aage J.