Show TOC

 Unique IndexesLocate this document in the navigation structure

Use

An entry in an index can refer to several records that have the same values for the index fields. You use a unique index to prevent these multiple entries. The index fields of a unique index have a key function, that is, they already uniquely identify each record of the table.

The primary index of a table is always a unique index since the index fields form the key of the table and uniquely identify each data record.

You can define a secondary index as a unique index when you create it. This ensures that there are no double records in the table fields contained in the index. An attempt to maintain an entry violating this condition in the table results in termination due to a database error. This is explained in the following figure by an example of table TAB.

The accessing speed does not depend on whether or not an index is defined as a unique index. A unique index is just a device you use in the database to make sure that records in a table or certain field combinations are unique.

Caution

A unique index for a client-dependent table must contain the client field.