Subject Re: [firebird-support] Primary Keys / Indexes
Author Martijn Tonies
> Usually FB tries to find indexes based on fields used in WHERE clauses
width
> AND. If they are ORed, the optimizer won't look for indexes on these
fields.

That is wrong.

for example:
select *
from ADRES
where RELATIEID = 1
or RELATIEID = 2

where "relatieid" is part of the PK, plan:
PLAN (ADRES INDEX
(RDB$PRIMARY166,RDB$FOREIGN49,RDB$PRIMARY166,RDB$FOREIGN49))

The optimizer is far more complex than this.


Martijn Tonies
Database Workbench - development tool for Firebird and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com