Subject | Re: one performance/index question |
---|---|
Author | Adam |
Post date | 2009-02-02T22:23:41Z |
--- In firebird-support@yahoogroups.com, "svanderclock"
<svanderclock@...> wrote:
not use that index, but I have observed times when it still tries
(particularly when the only other choice is natural).
The best you can do at the moment is to prevent the use of that index
manually via a query tweak. For example
select *
from TableA a
join TableB b on (a.TableA_ID = b.TableA_ID+0)
Such a query will prevent the foreign key index on table B from being
used in the join, and will probably force the following plan.
PLAN JOIN (B NATURAL, A INDEX (PK_TABLEA))
Adam
<svanderclock@...> wrote:
>This is indeed a limitation. Often the optimiser is smart enough to
> hmm, and how do you do with foreign key that have only very few
> value? cause foreign key automatiquelly create index !
not use that index, but I have observed times when it still tries
(particularly when the only other choice is natural).
The best you can do at the moment is to prevent the use of that index
manually via a query tweak. For example
select *
from TableA a
join TableB b on (a.TableA_ID = b.TableA_ID+0)
Such a query will prevent the foreign key index on table B from being
used in the join, and will probably force the following plan.
PLAN JOIN (B NATURAL, A INDEX (PK_TABLEA))
Adam