Subject Re: [firebird-support] Indexes automatically used?
Author Dmitry Yemanov
"Ivan Prenosil" <Ivan.Prenosil@...> wrote:
> > Is the db "smart enough" to automatically use the composite index in the
> > case mentioned:
> >
> > Order by sort_order, empno, shiftdate, created desc

Yes, if this is a descending index which includes all columns above in their
exact order.

> ORDER BY can use only one index.


> If you have separate indexes for each field, only one can be used (for
> sort_order field).

In fact, no indices can be used in this case, an external sort will be
performed instead. We don't support partially ORDER'ed retrievals.