2011-09-19-HashIndices

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

Info icon This 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
Image of page 1

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

View Full Document Right 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 Idea : Use directory of pointers to buckets , Double # of buckets by doubling the directory, splitting just the bucket that overflowed!
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern