Teradata – Unique Secondary Index(USI)

The syntax for Unique secondary index is as follows. Also well explained how index is useful in Teradata.

Syntax:

CREATE UNIQUE INDEX (department) ON tbl_employee;

If a Teradata SQL request uses secondary index values in a WHERE constraint, the optimizer may use the rowID in a secondary index suitable to access the qualifying rows in the data table.

If a secondary index is used only periodically by certain applications and is not routinely used by most applications, disk space can be saved by creating the index when it is needed and dropping it immediately after use.

A unique secondary index is very efficient, it typically allows access of only two AMPs, requires no spool file, and has one row per value, therefore, when a unique secondary index is used to access a row, two AMPs are involved.

Unique secondary indexes can thus improve performance by avoiding the overhead of scanning all AMPs.

For example, if a unique secondary index is defined on the department_name column of the Customer_service.department table (assuming that no two departments have the same name), then the following query is processed using two AMPs.

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.