Course: Data Science and Database Technologies
Source: Physical Access to Data, local path 14-PhysicalAccess.pdf, 41 PDF pages. The source credits Naeem Mahoto and presents DBMS material from the Data Base and Data Mining Group. Lecture number 14 follows the supplied filename identifier.
Lecture summary
SQL states the desired result, while physical access structures determine how the DBMS finds and stores the required tuples. The optimizer chooses an access plan; the access method manager translates it into requests for disk pages; and the buffer manager moves those pages into memory. The lecture then compares sequential, tree, hash and bitmap structures.
A heap file follows insertion order and is efficient for sequential scans. An ordered sequential structure follows a sort key and supports ordered searches, sorting, grouping and some joins, but insertions must preserve the order. Tree structures provide direct key access. B-Trees and B+-Trees remain balanced, while linked B+-Tree leaves support sequential range access. Clustered indexes keep data arranged with the index key; unclustered indexes store pointers to data whose physical position is independent.
Hash structures map a key to a block and are very efficient for equality predicates, but poor for ranges and vulnerable to collisions. Bitmap indexes represent each distinct value as a bit column and each tuple as a row, making Boolean combinations efficient for low-cardinality attributes. Their space cost grows with the number of distinct values.
Learning route
- Read Physical Access Structures and Access Methods for the storage structures and query tradeoffs.
- Read Clustered and Unclustered Indexes for the distinction that is easiest to confuse.
- Revisit DBMS Architecture and Query Processing to connect the optimizer, access method manager and buffer manager.
- Continue to Buffer Manager and Page Replacement for what happens after pages are selected.
Source map
| PDF pages | Material |
|---|---|
| 1-8 | DBMS architecture, physical access structures, access methods and disk pages |
| 9-14 | Sequential structures, heap files and ordered files |
| 15-25 | Tree structures, B-Trees, B+-Trees and balancing |
| 26-32 | Clustered/unclustered indexes and their tradeoffs |
| 33-37 | Hash structures and unclustered hash indexes |
| 38-41 | Bitmap indexes and their tradeoffs |
Worked comparison
Assume a STUDENT(StudentId, Name, Grade) table and an index on Grade.
- A clustered index stores matching grades near each other in the data file. A range such as
Grade BETWEEN 30 AND 34can scan nearby pages. - An unclustered index stores entries such as
30 -> T3and34 -> T6, while the actual tuples may be scattered. The index finds the rows, but retrieving many matches may require scattered page reads. - A hash index is suited to
Grade = 34, but does not preserve the order needed for a range scan. - A bitmap index is suited to a field such as
Jobwith a small set of values, where bitwise AND/OR can combine predicates.
These examples are added study explanations based on the source diagrams. The original PDF remains local.
Revision prompts
- Why does a DBMS need an access method manager between the optimizer and the buffer manager?
- Choose a heap, ordered file, B+-Tree, hash index or bitmap index for four different query types and explain the choice.
- Trace a range query through a clustered and then an unclustered B+-Tree.
- Why is equality a good use of hashing but a range a poor use?
- Why does a bitmap index become less attractive as attribute cardinality grows?
Source and scope
Naeem Mahoto, Physical Access to Data, local path 14-PhysicalAccess.pdf, 41 PDF pages. This note paraphrases the source and preserves its terminology. Added examples and the clustered/unclustered explanation are study clarifications.