Database Systems · Extendible Hashing with Last-Bits Keys, Overflow and Deletion
The idea in one paragraph
Extendible hashing is a dynamic hash file organisation: the file grows and shrinks one bucket at a time, and no full reorganisation is ever needed. A directory (an array of pointers) is indexed by the last bits of the hash value of a key. Each directory entry points to a bucket. When a bucket overflows, we split it (doubling the directory if needed, and repeating if all its keys fall on the same side); only when more than records have the same complete hash value (e.g. duplicates) do we attach an overflow bucket. Deletion reverses this: merge buddies, then halve the directory.
Notation and the two conventions
| Symbol | Meaning |
|---|---|
| the key (a decimal integer in GATE questions) | |
| hash value; here | |
| global depth — number of low-order (last) bits of used by the directory | |
| local depth of bucket — number of low-order bits on which all keys in bucket agree | |
| bucket capacity (number of records per bucket) | |
| number of directory entries |
Convention warning (state this in the exam):
- Many GATE questions (and Ramakrishnan–Gehrke) use global depth , local depth and the last (least significant) bits, . This chapter uses that convention.
- Silberschatz–Korth–Sudarshan index the directory by the first (high-order) bits of the hash value and write for the global depth and for a bucket's depth.
- Some texts use the first (most significant) bits; the mechanics are identical, only the bit position changes. If the question says "last bits" or gives , use LSB-first. If it says "first bits", take the leading bits of the binary form.
Key facts to memorise:
- Directory size .
- A bucket with local depth is pointed to by exactly directory entries (its buddy group).
- always.
- Two buckets are buddies if they have the same local depth and their hash suffixes differ only in the -th bit (i.e. they agree on the last bits).