Subject | Re: [firebird-support] Re: Very slow SQL |
---|---|
Author | Dmitry Yemanov |
Post date | 2007-08-22T05:29:21Z |
Adam wrote:
loop. And which solution is better mostly depends on table cardinalities.
Dmitry
>Right, but Firebird *is* able to optimize it using the opposite-way
> 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
loop. And which solution is better mostly depends on table cardinalities.
Dmitry