Database
Enthusiast

## How to find AMP numbe using Row-Hash value?

Dear Experts,

How to find AMP number using Row-Hash value. I have gone through something in a blog. Below one is the link.

Here for the PI value 55 Row-Hash is 11110000111100001111000011110000. For this they said AMP no=4. How they derived it?

Thanks,

Sridhar.

Tags (1)
4 REPLIES
Junior Contributor

## Re: How to find AMP numbe using Row-Hash value?

Hi Sridhar,

there are three hash-related functions:

- HASHROW to get the hash

- HASHBUCKET to get the first 16/20-bits as an Integer, the so-called hash bucket number

- HASHAMP to get the AMP on which a row is stored (i.e. a number between 0 and the number of AMPs on your system - 1)

SELECT HASHROW(55) AS hr, HASHBUCKET(hr) AS hb, HASHAMP(hb);

HASHROW/HASHBUCKET return the same values on every TD system using the same hash-algorithm, but HASHAMP returns an AMP-number specific to your system.

So AMP 4 is just an example, on your system it will probably be a different number.

Enthusiast

## Re: How to find AMP numbe using Row-Hash value?

Hi Dieter,

I got it now. Thank you so much for helping me in this regard.

Sridhar.

Enthusiast

## Re: How to find AMP numbe using Row-Hash value?

Hi Dieter,

The Hassh values is of 32 bit.  HBN is the first 16/20 bits of hash value. Is there any significance of remaining bytes of hashvalue ?  or these bits reserved for future enhancements ?

--Sri

Enthusiast

## Re: How to find AMP numbe using Row-Hash value?

Sri,

The first 16 or 20 bits are used to find the proper amp from the hash map, but the full 32 bit row hash is stored within the row, and is used in row retrieval.

Khurram