Subject Re: Plan not what I expected
Author chrisacron
Thanx Dmitry

mmmmm This is on a LI-V2.0.0.12691 Firbird 2.0 Release Candidate 3
server running in Linux Superserver. So the plan is still not what I
expected. Are there any settings I need to change to get the behaviour?

You say: "The current optimizer cannot use the same index for both
retrieval and sorting..."

This surpises me and would account for the re-ordering delays as it
reads everything and sorts it - which it won't have to if it read the
records in the correct sequnce to start off with.

Do you know if there are any plans to change the optimiser to use the
same key for retrieval and sorting - it would make the world of
difference. I have quite a few data situations where I have to deal
with this.

Regards

Chris

--- In firebird-support@yahoogroups.com, "Dmitry Yemanov" <dimitr@...>
wrote:
>
> "chrisacron" <chris@...> wrote:
> >
> > SELECT * FROM ImportBPData
> > WHERE ImportBatchId = 'GRID0jwSl4wc2cb3'
> > ORDER BY Field5
>
> The current optimizer cannot use the same index for both retrieval and
> sorting, so your plan is expected.
>
> > SELECT * FROM ImportBPData
> > WHERE ImportBatchId = 'GRID0jwSl4wc2cb3'
> > AND Field5 STARTING WITH 'Le'
> > ORDER BY Field5
>
> Here index IBD_KEYF5 can be used. And it will be in FB2 and ODS11, but
> previous versions have problems with such queries.
>
>
> Dmitry
>