Yannick Warnier <ywarnier@stripped> wrote on 03/10/2005 11:18:05:
> Hi all,
>
> Using PhpMyAdmin, I seldom get the warning message:
> PRIMARY and INDEX keys should not both be set for column `ID`
>
> I understand its meaning, but I was wondering to what extent having a
> field indexed AND being a primary key might slow down/speed up my
> queries.
>
> Is that gonna take twice the time if I am searching on the ID field,
> just because there are two indexes?
>
> I'd like to have a rough idea of how serioulsy I need to avoid these.
It will not slow down your searches at all, but it will slow down your
inserts. Since a PRIMARY KEY is a UNIQUE index that happens to have been
declared to be primary, you are simply storing the same information twice.
I cannot think of any possible benefit in having two identical indexes on
a table, and there is a cost to maintaining two index trees.
Alec