Re: Unique index or not
Posted in 1997
Peter Wang wrote: > Dear all, > > Suppose I have a table with three columns: col1, col2, col3. For data > integraty constraint, there is a unique index created for col1. For > query performance, I need to add an composite index on col1, and col2, Shouldn't this be on col2, col1? If it is the other way 'round, it may not be correctly used by the optimizer. In fact, if col2 is pretty unique, you could probably just do a col2 index... and if it isn't, would an index really help? > Which type of index you would suggest to add: unique or duplicate? I > think the uniqe type is unnecessary and has a bigger impact on insert. Never timed it myself, but the additional constraint might cause a performance glitch. > But I'm not sure whether it has advantage over the duplicate type on > select. I haven't heard of any reason why it would. > Any comments? These enough?