Subject RE: [firebird-support] Optimizing query
Author Svein Erling Tysvær
>> You lessened thanks with this variant from 1.11 minutes to 55.901 seconds
>>
>> I use firebird 2.1.3
>>
>> I use PLAN SORT (JOIN (A INDEX (FK_PAFACPAG_EFI), B INDEX
>> (FK_PAFACPAG_EFI)))
>>
>> FK_PAFACPAG_EFI = Field(ENTIDAD, FECHA, IDEDOC)
>>

>You could try breaking this index up into 3 separate indexes, one for each
>field. Not sure if that will make a difference but it might help because of
>the index optimizations that have taken place. Since I'm stuck on the 1.5
>version of Firebird for that moment, I will let others suggest other
>options.

If IDEDOC is selective and '2578' is a common value for ENTIDAD, then splitting up into separate indexes should help. That is, I doubt an index for FECHA actually is of much value for this particular query, but a separate index for IDEDOC will be useful if the field is selective (the combined index is only used for ENTIDAD when referring to B, since FECHA is not part of the join clause, it cannot be used for IDEDOC).

Set