DBMS Notes
This unit addresses one of the most critical aspects of database management — how data is physically stored on disk and how it can be retrieved efficiently. While SQL and
Unit Overview
This unit addresses one of the most critical aspects of database management — how data is physically stored on disk and how it can be retrieved efficiently. While SQL and relational algebra describe what data you want, the storage and indexing layer determines how fast you can actually get it. This is where theoretical database knowledge meets practical performance engineering.
Every time you execute a query, the database engine must decide how to locate the relevant records among potentially millions of rows stored across thousands of disk blocks. Without proper file organization and indexing, even simple queries could require scanning entire tables — an operation that might take minutes or hours on large databases. Indexing structures like B-trees and hashing techniques reduce this to milliseconds.
Topics Covered in This Unit
| Topic | Description | Key Concepts |
|---|---|---|
| File Organization | How records are physically arranged on disk | Heap files, sequential files, hashing, clustering |
| Indexing Introduction | Why indexes exist and how they speed up queries | Search key, index entry, access path |
| Single-Level Indexing | Flat index structures pointing directly to data | Primary index, secondary index, dense, sparse |
| Multi-Level Indexing | Hierarchical indexes reducing search space at each level | Index on index, tree-structured access |
| B-Tree | Self-balancing search tree for ordered data | Node splitting, minimum occupancy, logarithmic access |
| B+ Tree | B-Tree variant with all records in leaf nodes | Leaf-level linked list, range queries, bulk loading |
| Hashing Techniques | Direct address computation without tree traversal | Hash function, bucket, collision handling |
| Static Hashing | Fixed-size hash tables with overflow management | Bucket array, overflow chains, reorganization |
| Dynamic Hashing | Hash tables that grow and shrink with data | Extendible hashing, linear hashing, split operations |
| Query Processing | Steps from SQL statement to final result | Parsing, optimization, execution plan, pipelining |
| Query Optimization | Choosing the most efficient execution strategy | Cost estimation, equivalence rules, join algorithms |
| Cost Estimation | Calculating expected I/O and CPU costs for operations | Block transfers, seeks, selectivity estimation |
The Disk Access Problem
Understanding storage requires understanding why disk access is expensive. Reading data from a hard disk involves mechanical movement — the disk arm must seek to the correct track and wait for the platter to rotate to the correct sector. Even with modern SSDs, reading from persistent storage is orders of magnitude slower than reading from RAM.
| CPU Register | ~1 nanosecond |
| L1 Cache | ~2 nanoseconds |
| RAM | ~100 nanoseconds |
| SSD | ~100 microseconds (1,000x slower than RAM) |
| Hard Disk | ~10 milliseconds (100,000x slower than RAM) |
This enormous speed gap means that database performance is dominated by the number of disk block accesses. Every indexing technique in this unit aims to minimize disk I/O — the fewer blocks you read, the faster your query completes.
How Topics Build on Each Other
File organization establishes how records are physically laid out — this determines baseline performance for sequential scans. Single-level indexing adds a first layer of organization on top of the data files. Multi-level indexing addresses the problem of large single-level indexes by building indexes on indexes, naturally leading to B-trees and B+ trees as the standard index structures used in virtually every commercial database system.
Hashing provides an alternative to tree-based indexing — instead of traversing a tree structure, a hash function computes the exact location of a record in one step. Static and dynamic hashing explore fixed versus adaptive approaches to this technique.
Finally, query processing and optimization tie everything together — given a SQL query, the optimizer uses knowledge of available indexes, file organization, and cost estimation to choose the fastest execution plan.
Learning Objectives
After completing this unit, you should be able to:
- Compare different file organization methods and identify appropriate use cases for each
- Explain when to use primary versus secondary indexes, and dense versus sparse indexes
- Trace insertion and deletion operations in B-trees and B+ trees
- Apply hash functions and handle collisions in both static and dynamic hashing schemes
- Describe the steps in query processing from SQL parsing through execution
- Estimate query costs using block transfer and seek calculations
- Apply equivalence rules for algebraic query optimization
These skills are directly applicable in database administration, performance tuning, and systems programming roles.
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Unit 5 — Storage & Indexing.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Database Management Systems (DBMS) topic.
Search Terms
dbms, database management systems (dbms), unit, unit 5 — storage & indexing
Related Database Management Systems (DBMS) Topics