Lecture 5 - Indexes 2 - Template
Lecture 5 - Indexes 2 - Template
Topics:
Hashing
Spatial Indexing
Indexing in Postgres
Reading:
Chapter 14
Hashing
Static Hashing
Bucket:
Hash function h:
hash index:
Overflow chaining:
Example of Hash Organization
Note:
In static hashing, function h maps search-key values to a fixed set of B of bucket addresses.
Periodic rehashing
Extendable Hashing
Global Depth:
Local Depth:
Inserting elements: 2, 10, 8, 4, 5, 7, 11, where hash is key % 32, and bucket size is 3.
Multiple-Key Access
select ID
from instructor
where dept_name = “Finance” and salary = 80000
Q: Can also an index on (dept_name, salary) efficiently handle the following query?
Q: Can also an index on (dept_name, salary) efficiently handle the following query?
k-d tree
Quadtrees
Postgres Create Index Command:
Methods:
B-Tree:
Q: The documentation states that some queries involving the pattern matching operators LIKE can be
used. Which one of these would likely be supported?
col LIKE 'foo%'
col LIKE '%bar'
Hash: a 32-bit hash code derived from the value of the indexed column. Can only be a single column.
GiST:
SP-GiST:
BRIN:
Index Storage Parameters
fillfactor (integer)
deduplicate_items (boolean)