Primary Indexes
Indexing is one of the most important features of the Teradata RDBMS. In the Teradata RDBMS, an index is used to define row uniqueness and retrieve data rows, it also can be used to enforce the primary key and unique constraints for a table.- Primary index is a mandatory index.
- Created at the time of Table creation only.
- Only one PI for one Table, But PI can be composite upto 64 columns.
- If u don't create Index on the table system automatically takes first column as PI.
- It is a physical mechanism to assign a row to AMP.
- It effects on Data Distribution.
- UPI(Unique Primary Index) takes only Unique Values.
- NUPI(Non Unique Primary Index) takes Duplicates and Null Values.
- PPI for range based queries.
- PI applys physical mechanism at the time of storage and retrieval.
Types Of Indexes
Unique Primary Index:
- It takes only unique values and one null value.
- It distributes data across all AMP's uniformly (or) Randomly (or) evenly , so this distribution is called Uniform Distribution (or) Even distribution.
- One AMP operation and operates only one row
Non Unique Primary Index:
- It takes duplicates and nulls.
- It distributes the data across all AMP's ,it distributes duplicates into same AMP this distribution is less even distribution or uneven distribution.
- This distribution can also be called as 'SKEWED DISTRIBUTION' and less uniform less is 'SKEWNESS'.
- One AMP operation and effects many ROWS.
Partition Primary Index:
- Partition primary index is physically splitting the table into series of sub tables.
- one subtable for every partitioning value.
- When a single row is accessed, it looks first at the partitioning value to determine the subtable, then at the primary index to calculate the rowhash for the row(s).
Note:It helps to avoid full table scans.
No comments:
Post a Comment