Subject NATURAL sort
Author Roland Turcan
Hello firebird-support@yahoogroups.com!

I have this SQL statement which takes very long time, because it goes
through in "Natural".

Command:

select distinct a.psc,a.mesto from adresar a
where a.psc not in (select distinct b.psc from psc b);

Execution plan:

PLAN SORT ((B INDEX (IDX_PSC_PSC)))
PLAN SORT ((A NATURAL))

Indexes:

CREATE INDEX ADRESAR_PSC ON ADRESAR (PSC);
CREATE INDEX IDX_PSC_PSC ON PSC (PSC);

How to optimize it to get it faster and to use both indexes.

Thanks.

--
Best regards, TRoland
http://www.rotursoft.sk
http://exekutor.rotursoft.sk