Subject Re: [firebird-support] Plan not what I expected
Author Dmitry Yemanov
"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