Subject | Re: [ib-support] Plan query |
---|---|
Author | Svein Erling Tysvær |
Post date | 2002-06-26T07:25:02Z |
>What does " most restricting " mean though ?Simply that if you had to tables with a one-to-one relationship
SELECT Name
FROM A
join B on A.ID = B.ID
where a.phone = :phone
and b.country = :country
you would prefer
PLAN(A(Phone_Index), B(PK_B))
over
PLAN(B(Country_Index), A(PK_A))
And if the optimizer chose to use
PLAN(A(Phone_Index), B(PK_B, Country_Index))
you would know that the latter had no effect and could improve speed by
changing your query so that the Country_Index could not be used, e.g.
SELECT Name
FROM A
join B on A.ID = B.ID
where a.phone = :phone
and (b.country = :country or 2=0)
Set