You are on page 1of 2

8/7/2014

Summary of Primary Index Selection Criteria

Database Design > Primary Indexes > Summary of Primary Index Selection Criteria

Summary of Primary Index Selection Criteria


Guidelines for Selecting Primary Index Columns
The following table summarizes the guidelines for selecting columns to be used as primary indexes.

Guideline

Com m ents

Select columns that are most frequently


used to access row s.

Restrict selection to columns that are either unique or highly singular.

Select columns that are most frequently


used in equality predicate conditions.

Equality conditions permit the system to hash directly to the row having the conditional
value. When the primary index is unique, the response is never more than one row .
Inequality conditions require additional processing.

Select columns that distribute row s evenly


across the AMPs.

Distinct values distribute evenly across all AMPs in the configuration. This maximizes
parallel processing; how ever, temporal tables cannot have a unique primary index.
Row s having duplicate NUPI values hash to the same AMP and are stored in the same
data block w henever possible. This is good w hen row s are only moderately nonunique.
Row s having NUPI columns that are highly nonunique distribute unevenly, use multiple
data blocks, and incur multiple I/Os.
Extremely nonunique primary index values can skew space usage so markedly that the
system returns a message indicating that the database is full even w hen it is not.
This occurs w hen an AMP exceeds the maximum bytes threshold for a user or database
calculated by dividing the PERMANENT = n BYTES specification by the number of AMPs in
the configuration, causing the system to incorrectly perceive the database to be full.

Select columns that are not volatile.

Volatile columns force frequent row redistribution.

Select columns having very many more


distinct values than the number of AMPs in
the configuration.

If this guideline is not follow ed, row distribution skew s heavily, not only w asting disk
space, but also devastating system performance.

Do not select columns defined w ith Period,


ARRAY, VARRAY, Geospatial, BLOB,
CLOB, BLOBbased UDT, or CLOBbased
UDT data types.

You cannot specify columns that have BLOB, CLOB, BLOBbased UDT, CLOBbased
UDT, Period, ARRAY, VARRAY, or Geospatial data types in a primary index definition. If
you attempt to do so, the CREATE request aborts.

Do not select aggregated columns of a join


index.

When defining the primary index for a join index, you cannot specify any aggregated
columns.

This rule is particularly important for large tables.

You can, how ever, specify Period columns in the partitioning expression of a partitioned
table.

If you attempt to do so, the CREATE JOIN INDEX request aborts.

http://www.info.teradata.com/HTMLPubs/DB_TTU_14_00/index.html#page/Database_Management/B035_1094_111A/ch09.050.166.html

1/2

8/7/2014

Summary of Primary Index Selection Criteria

Copyright 1998-2013 by Teradata Corporation. All Rights Reserved.

http://www.info.teradata.com/HTMLPubs/DB_TTU_14_00/index.html#page/Database_Management/B035_1094_111A/ch09.050.166.html

2/2

You might also like