Skip to content

Oracle Unique constraint vs Unique Index

1. ) The difference between a unique index and a unique constraint starts with the fact that the constraint is a rule while the index is a database object that is used to provide improved performance in the retrieval of rows from a table. It is a physical object that takes space and is created with the DDL command .

2.) we can use either a unique OR non-unique index to support a unique constraint. Constraints are metadata, more metadata is good. We can define a foreign key to a unique constraint, not so a unique index.

3.) A constraint has different meaning to an index. It gives the optimizer more information and allows us to have foreign keys on the column whereas a unique index doesn’t. But most importantly because it is the right way to do it.

Pages: 1 2

Published inOracle PL SQL