Subject Re: [firebird-support] Query optimization - Why this plan ?
Author Ann W. Harrison
Alexandre Benson Smith wrote:
>>To revert to your problem, can you express your query as a series of
>>inner joins with the optional tables expressed as subqueries? Something
>>like this..
>>
>> select a1, select (b1 from b where b1 = a1), c1
>> from a join c on a1 = c1
>>
>>That should give you decent optimization and (counting on my fingers)
>>the same semantics.
>>
>
> I have done it with some of my queries (when I have one or two fields on
> the outer table), but in this case I select a bunch of columns (6
> columns ) from the outer tables then I think that it could lead to a lot
> of more reads (6 times more on one table), I will try this later and
> report the results.

Give it a try. Granted it's really ugly, but the whole path, index,
pointer page, and data will all be in cache after the first subselect so
it may be reasonably fast.

Regards,


Ann