Subject | Re: [ib-support] Plan not working |
---|---|
Author | Nando Dessena |
Post date | 2001-11-02T09:30:02Z |
Rod,
clause which isn't satisfied by an existing index. Since reading the
whole table in natural order is cheaper than reading it through an
index, IB does not use your index and sorts the result set afterwards.
What you need is probably an index on customer, rather than (name,
initials).
Ciao
--
____
_/\/ando
> I have CREATE INDEX CUSTOMER_NAME_KEY ON CUSTOMER (NAME, INITIALS);InterBase is reading the whole table anyway, since you put in a where
>
> If I write the query select * from customer where customer = 'SMITH'
> order by name, initials
>
> I get the plan : PLAN SORT ((CUSTOMER NATURAL))
>
> How do i change this to my index ? Surely interbase should pick up
> the fact that I have an index on name, inititals (the index is active)
clause which isn't satisfied by an existing index. Since reading the
whole table in natural order is cheaper than reading it through an
index, IB does not use your index and sorts the result set afterwards.
What you need is probably an index on customer, rather than (name,
initials).
Ciao
--
____
_/\/ando