Subject Re: [firebird-support] index desc
Author Svein Erling Tysvaer
bill_lam wrote:
> Suppose I am going to select in both ascending and desending order.
>
> select * from foo order by a
> select * from foo order by a desc
>
> Is only one index for ascending order (default) sufficient, or I have to use 2
> index, one ascend and the other desc?
> create index foo_a on foo(a)
> create desc index foo_a_d on foo(a)

You need both indexes.

> Also is it possible to create a composite index on some ascending column and
> some descending column, like equivalent of
> create index foo_inx on foo(a , b desc, c)

No, that is impossible. However, Firebird is quite good at using several
indexes in a plan, so you may not need a composite index.

Set