Subject | Re: [firebird-support] Re: Query plan insists on NOT USING an index |
---|---|
Author | Dmitry Yemanov |
Post date | 2007-07-04T07:09:21Z |
Franz J Fortuny wrote:
algorithm. IN (list) is transformed into a set of constant-driven OR'ed
equalities, while IN (subquery) is transformed into a correlated EXISTS.
outer->inner semi-join, hence it can use indices on the inner table but
the outer one is scanned sequentially. This is just how the thing is
designed.
Dmitry
>It's a completely different type of query with another execution
> However, it does handle the in predicate PERFECTLY in the first case
> (where the list is provided):
>
> in (xxx,xxx,xxx,xxx,xxx,xxx)
algorithm. IN (list) is transformed into a set of constant-driven OR'ed
equalities, while IN (subquery) is transformed into a correlated EXISTS.
> So, the problem might not be the IN PREDICATE, but the handling of theAgain, this is not a bug. IN (subquery) is always executed as an
> values generated by a subquery to be handled by the IN PREDICATE. This
> is where the BUG is located.
outer->inner semi-join, hence it can use indices on the inner table but
the outer one is scanned sequentially. This is just how the thing is
designed.
> Even if the TOR_EQUIV table is the first one and the others are joinedWhat is the reported plan? Do you have an index for tor_equiv.idsub1?
> to it: it will still NOT USE the SUBARTIS index.
Dmitry