Subject Re: [firebird-support] Optimize first clause in select query
Author Ann W. Harrison
diwic2 wrote:
>
> select first 200 msg, pid from my_messages
> where nodeid = 104000007 and pid >= 3000
> order by pid
>

Just a hunch, but this might help...

select first 200 msg, pid
from my_messages
where nodeid = 104000007 and pid >= 3000
order by nodeid, pid


The optimizer doesn't realize that it can use the
primary key index navigationally to avoid the sort
unless you include both parts of the key in the
order by list.

Regards,


Ann