0% found this document useful (0 votes)
10 views15 pages

Lecture 4 - Indexes 1 - Template

DBMS NOTES

Uploaded by

myotherface16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views15 pages

Lecture 4 - Indexes 1 - Template

DBMS NOTES

Uploaded by

myotherface16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Lecture 4 – Indexes – Part 1

COMP 519: Advanced Databases

Topics:
Basic Concepts
Ordered Indices
B+-Tree Index Files

Reading:
Chapter 14

Basic Concepts

Search Key:

Index file:

Q: How will size of index files compare to original data?

Q: Recall dictionary abstract data types. What data structures might we use to store values? What are
the implications of using these data structures?
Index Evaluation Metrics

Ordered Indices

Clustering index:

Secondary index:

Index-sequential file:

Dense Index Files


Sparse Index Files

Q: Can we use sparse indexes for secondary index?

Q: Can you think of the tradeoffs of sparse index files vs. dense index files?
Secondary Indices Example

Multilevel Index
Indices on Multiple Keys

Q: Suppose we had a query like select * from students where name = “John” and ID < 13000? How
would we find records using an index on name?

B+-Tree Index Files

Example of B+-Tree
Properties:

B+-Tree Node Structure

Leaf Nodes in B+-Trees


Non-Leaf Nodes in B+-Trees

Example of B+-tree

Observations about B+-trees

Q: Why do we have a pointer to next leaf node?


Typical node sizes and tree heights

Q: When searching for the next branch to follow in an internal node (or for a key in a leaf node),
what is best approach?

Non-Unique Keys

Q: What challenge do we have for our tree if we allow duplicate keys?

Solution
Updates on B+-Trees: Insertion

Example: Insert Adams into the following B+ tree:


Example: Insert “Lamport” into the following tree:
Updates on B+-Trees: Deletion

Example of Deletion:

Delete Srinivasan from the following tree:


Delete Singh and Wu from the following tree:

Delete Gold from the following tree:


Complexity of Updates

Bulk Loading and Bottom-Up Build

Inserting entries one-at-a-time into a B+-tree requires  1 IO per entry

Efficient alternative 1:

Q: If we can cache at least as many nodes as in the path from root to a leaf, why does this
approach improve performance?

Q: What will be true of most leaf nodes with this approach?

Efficient alternative 2:
B-Tree Index Files
Note: Index Organized Tables

You might also like