Extendible Hashing Primarily used for storage of files on disk

Slides:



Advertisements
Similar presentations
Extendible Hashing - Class Example
Advertisements

External Memory Hashing. Model of Computation Data stored on disk(s) Minimum transfer unit: a page = b bytes or B records (or block) N records -> N/B.
CS4432: Database Systems II Hash Indexing 1. Hash-Based Indexes Adaptation of main memory hash tables Support equality searches No range searches 2.
File Organizations Sept. 2012Yangjun Chen ACS Outline: Hashing (5.9, 5.10, 3 rd. ed.; 13.8, 4 th, 5 th ed.; 17.8, 6 th ed.) external hashing static.
Hash-Based Indexes Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY.
Hash-based Indexes CS 186, Spring 2006 Lecture 7 R &G Chapter 11 HASH, x. There is no definition for this word -- nobody knows what hash is. Ambrose Bierce,
1 Hash-Based Indexes Module 4, Lecture 3. 2 Introduction As for any index, 3 alternatives for data entries k* : – Data record with key value k – –Choice.
CPSC 335 Dr. Marina Gavrilova Computer Science University of Calgary Canada.
Hash Tables Hash function h: search key  [0…B-1]. Buckets are blocks, numbered [0…B-1]. Big idea: If a record with search key K exists, then it must be.
Additional notes on Hashing And notes on HW4. Selected Answers to the Last Assignment The records will hash to the following buckets: K h(K) (bucket number)
Chapter 11 (3 rd Edition) Hash-Based Indexes Xuemin COMP9315: Database Systems Implementation.
Copyright 2003Curt Hill Hash indexes Are they better or worse than a B+Tree?
Index tuning Hash Index. overview Introduction Hash-based indexes are best for equality selections. –Can efficiently support index nested joins –Cannot.
Hash Tables Hash function h: search key  [0…B-1]. Buckets are blocks, numbered [0…B-1]. Big idea: If a record with search key K exists, then it must be.
B+-tree and Hashing.
External Memory Hashing. Hash Tables Hash function h: search key  [0…B-1]. Buckets are blocks, numbered [0…B-1]. Big idea: If a record with search key.
1 Hash-Based Indexes Chapter Introduction  Hash-based indexes are best for equality selections. Cannot support range searches.  Static and dynamic.
FALL 2004CENG 3511 Hashing Reference: Chapters: 11,12.
1 Hash-Based Indexes Chapter Introduction : Hash-based Indexes  Best for equality selections.  Cannot support range searches.  Static and dynamic.
HASH TABLES Malathi Mansanpally CS_257 ID-220. Agenda: Extensible Hash Tables Insertion Into Extensible Hash Tables Linear Hash Tables Insertion Into.
1 Lecture 19: B-trees and Hash Tables Wednesday, November 12, 2003.
E.G.M. PetrakisHashing1 Hashing on the Disk  Keys are stored in “disk pages” (“buckets”)  several records fit within one page  Retrieval:  find address.
Hashing and Hash-Based Index. Selection Queries Yes! Hashing  static hashing  dynamic hashing B+-tree is perfect, but.... to answer a selection query.
Database Management 7. course. Reminder Disk and RAM RAID Levels Disk space management Buffering Heap files Page formats Record formats.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Hash-Based Indexes Chapter 11 Modified by Donghui Zhang Jan 30, 2006.
1.1 CS220 Database Systems Indexing: Hashing Slides courtesy G. Kollios Boston University via UC Berkeley.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Hash-Based Indexes Chapter 10.
CPSC 461 Final Review I Hessam Zakerzadeh Dina Said.
1 Lecture 21: Hash Tables Wednesday, November 17, 2004.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 18 Indexing Structures for Files.
Chapter 5 Record Storage and Primary File Organizations
Database Management 7. course. Reminder Disk and RAM RAID Levels Disk space management Buffering Heap files Page formats Record formats.
CS422 Principles of Database Systems Indexes Chengyu Sun California State University, Los Angeles.
CS422 Principles of Database Systems Indexes
CS522 Advanced database Systems
Dynamic Hashing (Chapter 12)
Lecture 21: Hash Tables Monday, February 28, 2005.
Are they better or worse than a B+Tree?
Hash-Based Indexes Chapter 11
Hashing CENG 351.
Database Management Systems (CS 564)
Dynamic Hashing.
External Memory Hashing
Introduction to Database Systems
Faloutsos & Pavlo Lecture#11 (R&G ch. 11) Hashing
External Memory Hashing
CS222: Principles of Data Management Notes #8 Static Hashing, Extendible Hashing, Linear Hashing Instructor: Chen Li.
Hash-Based Indexes R&G Chapter 10 Lecture 18
Hash-Based Indexes Chapter 10
External Memory Hashing
static hashing & dynamic hashing hash function
CS222P: Principles of Data Management Notes #8 Static Hashing, Extendible Hashing, Linear Hashing Instructor: Chen Li.
Hashing.
Hash-Based Indexes Chapter 11
Index tuning Hash Index.
Advance Database System
Database Systems (資料庫系統)
LINEAR HASHING E0 261 Jayant Haritsa Computer Science and Automation
2018, Spring Pusan National University Ki-Joune Li
Module 12a: Dynamic Hashing
Chapter 11: Indexing and Hashing
CPSC-608 Database Systems
Hash-Based Indexes Chapter 11
CMSC 341 Extensible Hashing.
Chapter 11 Instructor: Xin Zhang
Extendable hashing M.B.Chandak.
Extendible Hashing Example
CS222/CS122C: Principles of Data Management UCI, Fall 2018 Notes #07 Static Hashing, Extendible Hashing, Linear Hashing Instructor: Chen Li.
Presentation transcript:

Extendible Hashing Primarily used for storage of files on disk Number of disk accesses is important factor (only 2 needed for search) The hash table grows as required Use a directory of pointers to buckets If directory has (global) depth g then it is organized according to the first g bits One entry for every possible value with g bits Entry for bit pattern b1…bg has a pointer to bucket containing all records with keys k for which h(k) starts with bit pattern b1…bg Some other versions use bit pattern at end, not start. Each bucket has its own local depth l (l ≤ g): the number of bits used for that bucket COSC 2P03 Week 12

Extendible Hashing Example Suppose that g=2 and bucket size = 4. Suppose that we have records with these keys and hash function h(key) = key mod 64: key h(key) = key mod 64 bit pattern 288 32 100000 8 001000 1064 40 101000 120 56 111000 148 20 010100 204 12 001100 641 1 000001 700 60 111100 258 2 000010 1586 50 110010 44 101010 COSC 2P03 Week 12

Extendible Hashing Example – directory and bucket structure 00 01 10 11 l = 2 8 148 288 120 204 1064 700 641 44 1586 258 COSC 2P03 Week 12

Bucket and directory split Insert 68 68 mod 64 = 4 = 000100 g=3 000 001 010 011 100 101 110 111 l = 3 l = 2 641 8 148 288 120 258 204 1064 700 68 44 1586 COSC 2P03 Week 12

Bucket split – no directory split Insert 48 and 575 48 mod 64 = 48 = 110000 575 mod 64 = 63 = 111111 g=3 000 001 010 011 100 101 110 111 l = 3 l = 2 641 8 148 288 1586 120 258 204 1064 48 700 68 44 575 COSC 2P03 Week 12

Multiple splits Insert 16, 18, 22, 23 16 mod 64 = 16 = 010000 Setting l=3 gives this intermediate (partial) picture… Continue to next page… 010 011 l = 3 148 16 18 22 23 COSC 2P03 Week 12

Multiple splits, continued Setting l=4 (and thus g=4) gives this final result… g=4 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 l = 3 l = 4 l = 2 641 8 16 148 288 1586 120 258 204 18 22 1064 48 700 68 23 44 575 COSC 2P03 Week 12