SlideShare a Scribd company logo
1 of 1
浅谈 Teradata PI 和 SI
Primary index is the most important feather of Teradata, causing the Primary Index decides the
distribution of rows in a table on AMPs.
There are two types of Primary Index in the Teradata Database, unique Primary Index and Non-
unique Primary Index. Unique Primary Index results in even row distribution and eliminates the
duplicate rows. While Non-Unique Primary Index results in potentially skewed distribution. Non-
Unique Index worse, makes heavily-skewed distribution ignored the Teradata Parallel mechanism.
So how the PI decides the distribution of a row of a table on an AMP? The Primary Index value
comes into the Hashing Algorithm, and via Hashing Algorithm, the so called 32bit row hash is
produced. The first 16 bit is called Row Hash, used to identify the hash map’s entry. The hash map
is an array which associates the DSW with a specific AMP.
Secondary Index is another alternative way to access the row stored on the AMP. It is a sub-
table in all the AMPs. Like Primary Index, there are two kinds of secondary index, Unique Secondary
Index and Non-Unique Index. Unlike the Primary Index, Secondary Index does not have a effect on
the distribution on AMPs.
Let us take the accessing data using secondary index for instance.
Unique Secondary Index is efficient. This kind of accessing typically allows of only two AMPs.
So using Unique Secondary Index to access a row, two AMPs are involved.
Non-Unique secondary index (NUSI) may have multiple rows per value. A NUSI is efficient when you
want to prevent a full table scan.

More Related Content

What's hot

Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
wmassie
 
Spreadsheets Concepts and Vocab
Spreadsheets Concepts and VocabSpreadsheets Concepts and Vocab
Spreadsheets Concepts and Vocab
Danny Ambrosio
 
Standard Grade Administration - Software Applications
Standard Grade Administration - Software ApplicationsStandard Grade Administration - Software Applications
Standard Grade Administration - Software Applications
Musselburgh Grammar School
 

What's hot (20)

Spreadsheet basics ppt
Spreadsheet basics pptSpreadsheet basics ppt
Spreadsheet basics ppt
 
spreadsheet program
spreadsheet programspreadsheet program
spreadsheet program
 
R Datatypes
R DatatypesR Datatypes
R Datatypes
 
Spreadsheet Concepts
Spreadsheet ConceptsSpreadsheet Concepts
Spreadsheet Concepts
 
Trees
TreesTrees
Trees
 
Linked list
Linked listLinked list
Linked list
 
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
 
Linked list
Linked listLinked list
Linked list
 
Spreadsheet terminology
Spreadsheet terminologySpreadsheet terminology
Spreadsheet terminology
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
Spreadsheets Concepts and Vocab
Spreadsheets Concepts and VocabSpreadsheets Concepts and Vocab
Spreadsheets Concepts and Vocab
 
Tree data structure
Tree data structureTree data structure
Tree data structure
 
Sql joins
Sql joinsSql joins
Sql joins
 
Avl tree
Avl treeAvl tree
Avl tree
 
Introduction to spreadsheets
Introduction to spreadsheetsIntroduction to spreadsheets
Introduction to spreadsheets
 
Introduction to spreadsheets
Introduction to spreadsheetsIntroduction to spreadsheets
Introduction to spreadsheets
 
Key,ID Field and Tables Relationship
Key,ID Field and Tables Relationship Key,ID Field and Tables Relationship
Key,ID Field and Tables Relationship
 
Standard Grade Administration - Software Applications
Standard Grade Administration - Software ApplicationsStandard Grade Administration - Software Applications
Standard Grade Administration - Software Applications
 
Create table relationships
Create table relationshipsCreate table relationships
Create table relationships
 
Linked list2
Linked list2Linked list2
Linked list2
 

浅谈Teradata pi和si

  • 1. 浅谈 Teradata PI 和 SI Primary index is the most important feather of Teradata, causing the Primary Index decides the distribution of rows in a table on AMPs. There are two types of Primary Index in the Teradata Database, unique Primary Index and Non- unique Primary Index. Unique Primary Index results in even row distribution and eliminates the duplicate rows. While Non-Unique Primary Index results in potentially skewed distribution. Non- Unique Index worse, makes heavily-skewed distribution ignored the Teradata Parallel mechanism. So how the PI decides the distribution of a row of a table on an AMP? The Primary Index value comes into the Hashing Algorithm, and via Hashing Algorithm, the so called 32bit row hash is produced. The first 16 bit is called Row Hash, used to identify the hash map’s entry. The hash map is an array which associates the DSW with a specific AMP. Secondary Index is another alternative way to access the row stored on the AMP. It is a sub- table in all the AMPs. Like Primary Index, there are two kinds of secondary index, Unique Secondary Index and Non-Unique Index. Unlike the Primary Index, Secondary Index does not have a effect on the distribution on AMPs. Let us take the accessing data using secondary index for instance. Unique Secondary Index is efficient. This kind of accessing typically allows of only two AMPs. So using Unique Secondary Index to access a row, two AMPs are involved. Non-Unique secondary index (NUSI) may have multiple rows per value. A NUSI is efficient when you want to prevent a full table scan.