The hash function used in Extensible Hashing
Comment of the terminology
Logical and Physical buckets
The traditional hashing technique
Example:
E.g.: Logical bucket # = physical bucket #
The Extensible Hashing technique
Example:
Important property achieved by the
logical → physical bucket mapping
Important property achieved by the
logical → physical bucket mapping
In other words:
Example Extensible Hashing
Example Extensible Hashing
Example:
Example Extensible Hashing
Notice that:
Hash values that ends in
000 and
100
are stored in physical bucket 00
Hash values that ends in
001 and
101
are stored in physical bucket 01
Hash values that ends in
010 and
110
are stored in physical bucket 10
Hash values that ends in
011 and
111
are stored in physical bucket 11
Example Extensible Hashing
Example Extensible Hashing
Result:
the logical hash table size
will increase
Example Extensible Hashing
We can "fix" the mapping errors in
the new hash function using
a modified mapping:
Example Extensible Hashing
Verify that:
Handling overflow in Extensible Hashing by
increasing physical bucket size
Overflow situation:
Handling overflow in Extensible Hashing by
increasing physical bucket size
Overflow situation:
Handling overflow in Extensible Hashing by
increasing physical bucket size
Allocate a new disk block:
Handling overflow in Extensible Hashing by
increasing physical bucket size
Re-hash the keys in the overflow block:
Handling overflow in Extensible Hashing by
increasing physical bucket size
Adjust logical → physical mapping:
Increasing physical bucket size:
a concrete example
Initial state:
Increasing physical bucket size:
a concrete example
We can increase the
physical bucket size by
spliting a
(physical) bucket
Increasing physical bucket size:
a concrete example
We first re-hash all the
keys
using an additional bit in
the hash key:
Increasing physical bucket size:
a concrete example
Adjust the
logical → physical mapping:
Increasing physical bucket size:
a concrete example
Final state:
now we have 5 physical buckets
❮
❯