2011-09-19-HashIndices - Hash-Based Indexes Database...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Hash-Based Indexes Database Management Systems, R. Ramakrishnan and J. Gehrke 1 Introduction As for any index, 3 alternatives for data entries k* : Data record with key value k < k , rid of data record with search key value k > Database Management Systems, R. Ramakrishnan and J. Gehrke 2 < k , list of rids of data records with search key k > Hash-based indexes are best for equality selections . Provide constant-time searches But cannot support range searches Static and dynamic hashing techniques exist – Trade-offs similar to ISAM vs. B+ trees Static Hashing # primary pages fixed, allocated sequentially, never de-allocated; overflow pages if needed. h ( k ) mod N = bucket to which data entry with key k belongs . (N = # of buckets) Database Management Systems, R. Ramakrishnan and J. Gehrke 3 h(key) mod N h key Primary bucket pages Overflow pages 2 0 N-1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Static Hashing (Contd.) Buckets contain data entries . Hash fn works on search key field of record r. Must distribute values over range 0 . .. N-1. Database Management Systems, R. Ramakrishnan and J. Gehrke 4 h ( key ) = (a * key + b) usually works well. a and b are constants; lots known about how to tune h . Long overflow chains can develop and degrade performance Extendible and Linear Hashing : Dynamic techniques to fix this problem. Extendible Hashing Main idea: If bucket (primary page) becomes full, why not re-organize file by doubling # of buckets? – Essentially “splitting” buckets But reading and writing all buckets is expensive Database Management Systems, R. Ramakrishnan and J. Gehrke 5 But reading and writing all buckets is expensive!
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

2011-09-19-HashIndices - Hash-Based Indexes Database...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online