how hash value is calculated or AMP is chosen for new row

General

how hash value is calculated or AMP is chosen for new row

Hi 

please help with my understanding on row placement

from what i have learned so far, i understand Teradata distributes the rows evenly on all AMPs if the table has Unique Primary Index and the AMP to place the new row is chosen based on the hash value arrived from the Unique Primary Index value of the new row. 

lets consider the below example and assume a new row is being inserted to the table. to maintain the even distribution, the new row should be placed in AMP 3. 

here my question is, whether the hash value is calculated based on the AMP it should place the new row in ? OR the hash value is calculated first and co-incidentally it maps to the right AMP all th time to maintain the even distribution of rows among the AMPs

AMP 1 - 12 rows

AMP 2 - 12 rows

AMP 3 - 11 rows

Thanks in advance
Tags (1)
1 REPLY
Enthusiast

Re: how hash value is calculated or AMP is chosen for new row

The value of the hash is independent which amp the row ends up.  There is a hash map that determines what hash results map to which amp.  

If you have a system with 240 amps and a table with a UPI that only has 50 rows, you will NOT get even distribution, as there aren't enough rows to map to every amp.  

The even distribution of a UPI is a happy by-product of the hash map.  Remember even distribution of data is a secondary consideration of PI selection.  The most important consideration of a TD PI, UPI or NUPI, is the most common data access path.

Cheers!