What role does last 16bit play in 32 bit ROW HASH

General
Enthusiast

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
Tags (1)
5 REPLIES
Enthusiast

Re: What role does last 16bit play in 32 bit ROW HASH

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.
Enthusiast

Re: What role does last 16bit play in 32 bit ROW HASH

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 ?
Enthusiast

Re: What role does last 16bit play in 32 bit ROW HASH

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

Re: What role does last 16bit play in 32 bit ROW HASH

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.

Enthusiast

Re: What role does last 16bit play in 32 bit ROW HASH

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.