Is there any performance reason to use unique index

2004-09-09 Thread Wesley Furgiuele
Hi: I was wondering if there is any performance-related reason to use a unique index versus a standard index? Is the only benefit of a unique index that it will prevent duplicate values from being inserted into a table unless explicitly allowed? I have a column, colA, that I know contains only

Re: Is there any performance reason to use unique index

2004-09-09 Thread SGreen
The uniqueness constraint would only be enforced during an INSERT or an UPDATE. If your table is read-only, declaring the index as UNIQUE will be overkill. I can't tell you about any kind of performance hit during reading but I try to follow the maxim don't ask for it if you won't need it. I

Re: Is there any performance reason to use unique index

2004-09-09 Thread Harrison
A unique index can actually be faster than a regular index. The reason is that MySQL knows that there can only be a single matching row for each value. In particular, this allows you to get const and eq_ref for the type in an EXPLAIN, which are two of the fastest methods of table access.