Subject Re: [firebird-support] Re: Very slow SQL
Author Dmitry Yemanov
Adam wrote:
>
> Firebird is not able to optimize some fixed subqueries.
>
> The current optimiser would never convert:
>
> select ID
> from Maintable
> where SubqueryID in (select ID from SubqueryTable)
>
> To (in PSQL):
>
> for select ID from SubqueryTable
> into :SubqueryID
> do
> begin
> for select ID from MainTable where SubqueryID = :SubqueryID
> into :ID do
> begin
> suspend;
> end
> end

Right, but Firebird *is* able to optimize it using the opposite-way
loop. And which solution is better mostly depends on table cardinalities.


Dmitry