1 / 9

Dynamic Hashing

As the database grows over time, we have three options: Choose hash function based on current file size. Get performance degradation as file grows. Choose hash function based on anticipated file size. Space is wasted initially. Periodically re-organize hash structure as file grows.

bakergerald
Télécharger la présentation

Dynamic Hashing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. As the database grows over time, we have three options: Choose hash function based on current file size. Get performance degradation as file grows. Choose hash function based on anticipated file size. Space is wasted initially. Periodically re-organize hash structure as file grows. Requires selecting new hash function, recomputing all addresses and generating new bucket assignments. Costly, and shuts down database. Dynamic Hashing

  2. A hash table that grows to handle more items. The associated hash function must change as the table grows. • Some schemes may shrink the table to save space when items are deleted.

  3. Some hashing techniques allow the hash function to be modified dynamically to accommodate the growth or shrinking of the database. These are called dynamic hash functions. • Extendable hashing is one form of dynamic hashing. • Extendable hashing splits and coalesces buckets as database size changes. • This imposes some performance overhead, but space efficiency is maintained. • As reorganization is on one bucket at a time, overhead is acceptably low

  4. Dynamic Hashing: • Advantages: • Extendable hashing provides performance that does not degrade as the file grows. • Minimal space overhead - no buckets need be reserved for future use. • -Even performance (as index grows continually and gradually)‏ • -Enables file expansion without reorganization of records • -Forest of binary trees avoids index’s becoming too deep

  5. Disadvantages: • -Extra storage needed for index • Suitable applications: • -Applications involving relatively dynamic files, single record fetches

  6. Static Hash Tables  • # of buckets never changes • Usually each hashed value points to the data block of the record (no indirection) • (Indirection: buckets of pointers (instead of records)  • Buckets of records, not pointers • Need to search within the bucket for the record with the key

  7. Basic or static hashing :- It is the type of hashing which allocates a fixed number of buckets and it keep a check for the overflow blocks in a bucket which are chained together. • Problem with static hashing: • Problem:overflow? • Problem:underflow?(underutilization)

  8. What if too many insertions?  • Overflows • Reorganizations: • Choose a new # of buckets • and a new hash function • Not “static” any more • Thus we need dynamic hash tables.

  9. Dynamic Hashing • idea: shrink / expand hash table on demand.. • ..dynamic hashing • Details: how to grow gracefully, on overflow? • Many solutions • One of them: ‘extendible hashing’

More Related