Re: Unique index or not
Posted in 1997
Topics: Performance & Tuning, SQL Development & Query Writing, Triggers, Constraints & Referential Integrity
FLAME MODE = ON I cannot speak specifically about Informix, but in mathematical terms... If the set A contains unique data, then the set A+B will also contain unique data Therefore, IMHO, 1. The unique is unnecessary for the composite key 2. The unique constraint adds overhead to an insert operation However, perhaps a select statement is faster given that only one row is known to match the query. SO, the final answer is "IT DEPENDS" ;-) FLAME MODE = OFF -- Vince pachiano@dayton.bassinc.com "Opinions expressed may not be correct--- But at least they're my own !!! ;-) Peter Wang <pwang@socs.uts.edu.au> wrote in article <5ob9gs$b7l@cssun.mathcs.emory.edu>... > 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, > 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. > But I'm not sure whether it has advantage over the duplicate type on > select. > > Any comments? > > Cheers. >