Subject RE: [firebird-support] Optimal algorithm for inventory
Author Leyne, Sean
Slavomir,

> in this case Firebird will NOT use both part of index, please try it.

Actually Firebird can use a compound index!

It depends on statement AND index which is constructed.

I certainly agree that the SQL:

select count(*) from person where BirthDate<= :EndDate and (DeathDate>
:EndDate or DeathDate is null)

will not benefit a compound index based on (BirthDate, DeathDate).

But it will fully use a compound index based on (DeathDate, BirthDate).

And, Yes, I have tried it!

The plan which is generated is:
PLAN (Table INDEX (Index, Index))


Sean