2 Day Developer > Managing Database Objects > Managing Indexes > Indexes for Use with Constr...
Indexes for Use with Constraints |
Previous |
Next |
All enabled unique and primary keys require corresponding indexes. Oracle Database XE automatically creates the indexes necessary to support data integrity defined with constraints when you add or enable those constraints. For example, a column with the constraint that its values be unique causes Oracle Database XE to create a unique key index.
Note the following:
Constraints use existing indexes where possible, rather than creating new ones.
Unique and primary keys can use non unique and unique indexes. In addition, they can use just the first few columns of non unique indexes.
At most, one unique or primary key can use each non unique index.
The column orders in the index and the constraint do not need to match.
For performance purposes, you might want to add an index to the columns you define in a child table when adding a foreign key constraint. Oracle Database XE does not do this for you automatically.