Subject | Re: [firebird-support] correlated subquery optimize problem under FB 2 |
---|---|
Author | Tomáš Horák |
Post date | 2007-12-10T11:04:16Z |
Hi, in original query is this layout - starting some queries connected
via INNER JOIN, on the end 2 queries connected via LEFT JOIN.
Problem, what I have is how FB 2 evaluates conditions from WHERE
clausule. In WHERE clausule is simple condition (something like
A.IsClosed = 'N') and correlated subquery condition
(something like A.ID in (select ID from ...............)). A is alias of
some bigger table - around 60 000 records.
They are connected with AND. Suppose if first condition is false, then
all in where is false and there is no need to continue in evaluation and
run correlated subquery.
But this is what happen. Based on performance from IB expert I am seeing
there is much more reads from correlated table in FB2 then in FB1.5.
Problem is, that this will happen only in some cases, so I will try to
produce some easier example about this behaviour.
tomas
.
Alexandre Benson Smith wrote:
via INNER JOIN, on the end 2 queries connected via LEFT JOIN.
Problem, what I have is how FB 2 evaluates conditions from WHERE
clausule. In WHERE clausule is simple condition (something like
A.IsClosed = 'N') and correlated subquery condition
(something like A.ID in (select ID from ...............)). A is alias of
some bigger table - around 60 000 records.
They are connected with AND. Suppose if first condition is false, then
all in where is false and there is no need to continue in evaluation and
run correlated subquery.
But this is what happen. Based on performance from IB expert I am seeing
there is much more reads from correlated table in FB2 then in FB1.5.
Problem is, that this will happen only in some cases, so I will try to
produce some easier example about this behaviour.
tomas
.
Alexandre Benson Smith wrote:
>
> Hi Thomas !
>
> I had not followed the entire thread.
>
> But a quick suggestion:
> Move the OUTER JOIN's to the end, put all INNER JOIN's first
>
> see you !
>
> --
> Alexandre Benson Smith
> Development
> THOR Software e Comercial Ltda
> Santo Andre - Sao Paulo - Brazil
> www.thorsoftware.com.br
>
>