On 04/18/2002 12:41:15 PM tycho wrote:
> > Don't know if the optimizer takes this into consideration, but a query that
> uses a primary and/or unique key in the where-clause, should always choose to
> use
> > the related indices (assuming the table size is above a certain threshold).
> Since a primary key/unique index always restricts the resultset to a single
> row.....
>
> I don't think so.
>
> eg. table with primary key "pk", taking values from 1 to 1000000 (so
> 1000000 records)
>
> select * from table where pk > 5
>
> should probably not use the index ...

Oops, you're right of course. Rephrase the above as 'a query that uses a primary key to uniquely qualify a single row' (which pretty much restricts it to the = operator with a constant). Still, this is probably a fairly common case.....

Maarten

----

Maarten Boekhold, maarten.boekhold@reuters.com

Reuters Consulting
Dubai Media City
Building 1, 5th Floor
PO Box 1426
Dubai, United Arab Emirates
tel:+971(0)4 3918300 ext 249
fax:+971(0)4 3918333
mob:+971(0)505526539


-------------------------------------------------------------- --
Visit our Internet site at http://www.reuters.com

Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of Reuters Ltd.