Re: Index selectivity
Date: 9 Mar 2004 08:07:08 -0800
Message-ID: <2687bb95.0403090807.13ce1c21_at_posting.google.com>
andrewst_at_onetel.net.uk (Tony) wrote in message news:<c0e3f26e.0403081227.51fffae0_at_posting.google.com>...
> "Cox" <tushar_mahapatra_at_yahoo.com> wrote in message news:<3HZ2c.11709$fD2.3427@lakeread02>...
> > It is always recommended that index keys must be selective. Does that mean
> > that it is good to follow the general rule of always placing the primary key
> > at the end of every index?
>
> No: if you had the primary key at the end, it would only make a
> difference if you included the primary key value in the query. And if
> you did that, then the primary key index could be used anyway. What
> it means is that it is not worth indexing at all on columns that have
> very few distinct values, since it will probably be faster to scan the
> whole table.
Whatever your source of the "general" rule that the PK should be placed at the end of every index to make it selective should be lost along with the rule. The rule has NO merit.
IMHO -- Mark D Powell -- Received on Tue Mar 09 2004 - 17:07:08 CET