Subject ODP: [firebird-support] How to index this table
Author Karol Bieniaszewski

Hi

 

Your problem is that you have (X or X) and (Y or Y)

Firebird cannot use composite index here.

Maybe it can somehow make something like (X1 and Y1) or (X1 and Y2) or … or (X1 and YN) or (X2 and Y1) or (X2 and Y2) …. (XN and YN)

But it will be never optimal.

 

Create separate indexes for magasin and caisse – then Firebird can use BITMAP OR + BITMAP AND

 

Another optimisation will be instead of multiple OR put all values into temporary table and then join with it.

Any other optimisations depend on value propagation in particular fields involved in the where clause.

 

Regards,

Karol Bieniaszewski