All Forums General
TD_Raj 50 posts Joined 05/10
29 Sep 2010
What role does last 16bit play in 32 bit ROW HASH

I learned that after hashing algorithm 32bit ROW HASH is generated.
First 16bit helps in determining AMP in which we will store our row.
However I want to know what role does last 16bit have?

Thanks

Jim Chapman 449 posts Joined 09/04
29 Sep 2010

Actually, in recent versions the first 20 bits of the hash are used to select the AMP. The entire 32-bit hash is used to determine the physical placement of the row within the hash. Thus rows with the same primary index value will be physically adjacent.

TD_Raj 50 posts Joined 05/10
29 Sep 2010

Hi Jim

I used to think that last 16bits are used to identify Table to which it belongs to.
Can you confirm if last 16bits act as Table ID or not ?

Jim Chapman 449 posts Joined 09/04
30 Sep 2010

No. The table ID is a separate 32-bit number.

abhi_insignia 13 posts Joined 06/11
04 Jan 2012

the 1st 16 bits tell the bucket number in the hash map which in turn points to the amp containing that row hash value. The 32 bits on a whole tell the AMP, the location of the row in the disk.

Raja_KT 1246 posts Joined 07/09
04 Oct 2013

I think it is the ist 16 or 20 bits of the rowhash tell us the bucket number, depending on the systems with 65,536 hash buckets or 1,048,576 hash buckets.

Raja K Thaw
My wiki: http://en.wikipedia.org/wiki/User:Kt_raj1
Street Children suffer not by their fault. We can help them if we want.

You must sign in to leave a comment.