A NUPI means that the value for the selected column can be NON-UNIQUE duplicate values can exists.A NUPI will almost never spread the table rows evenly.
An ALL-AMP operation will take longer if the data is unevenly distributed you might pick a NUPI OVER an UPI because the nupi columns may be more effective for query access and joins.
Example :
We have selected LAST_NAME to be our PRIMARY INDEX we are anticipating that there will be individuals in the table with the same last name.
NUPI:
EMP_NO
DEPT_NO
FIRST_NAME
LAST_NAME
SALARY
1111
1000
SMITH
JONES
50000
3333
3000
JOHNSON
STEWART
45000
4444
4000
PETER
JONES
85000
6666
6000
Sandy
Vatish
96000
8888
8000
Mat t
Stewart
52000
9999
9000
Leonia
Lacy
63000
DUPLICATES WITH NUPI
NUPI is Several AMP Operation.
Example :
EMP_NO
DEPT_NO
FIRST_NAME
LAST_NAME
SALARY
1111
1000
SMITH
JONES
50000
3333
3000
JOHNSON
STEWART
45000
4444
4000
PETER
JONES
85000
6666
6000
Sandy
Vatish
96000
8888
8000
Mat t
Stewart
52000
9999
9000
Leonia
Lacy
63000
DUPLICATES WITH NUPI
NUPI is Several AMP Operation.
Data Distribution or storing a record in NON Unique Primary Index :
{ Please refer Primary Index Page for Diagram}Step 1: After record reaches the PE , Row hash is generated for the given row , In this case Uniqueness value is incremented in ascending order based on the number rows which poses same Row hash value.
Step 2 : The Teradata searches the Amp value in the hash map which is present in BYNET based on the ROW ID generated .
Step 3 : After searching for the right AMP , the row is moved to the respective Vdisk which is under the AMP provided in step 2
Data Retrieval NON Unique Primary Index :
Step 1: When Row came to PE , the respective Row Hash value is calculated along with the Unique value.Step 2 : Based on the Row hash value and unique value the respective AMP is taken
Step 3 : The Row is searched in the Amp using the Physical row id provided and given back to PE.
CREATING A NON-UNIQUE PRIMARY INDEX :
SQL syntax to create a NON- UNIQUE PRIMARY INDEX is
CREATE TABLE SAMPLE-2
(COL-X INT, COL-Y INT, COL-Z INT)
PRIMARY INDEX (COL-X);
0 Comments