Efficient Disk Organization Strategies in Relational DBMS

What is the I/O cost of joining the Stu and Enr relations using the tuple-oriented nested loops join algorithm in a relational DBMS scenario?

I/O Cost Calculation using Tuple-Oriented Nested Loops Join Algorithm

Data:
Stu relation tuples: 6,500
Enr relation tuples: 120,000
Page size: 25 tuples for Stu, 125 tuples for Enr
Assumption: No records span multiple pages

Calculation:
For each tuple in Stu (6,500 I/Os): Read a page of Stu and for each tuple, read a page of Enr and perform the join operation.
Total I/O cost: 6,500 * (1 + (120,000 / 25)) = 6,132,240 I/Os

Therefore, the I/O cost of joining the Stu and Enr relations using the tuple-oriented nested loops join algorithm is 6,132,240 I/Os.

What is the I/O cost of joining the Students and EnrollsIn relations using the index nested loops join algorithm in a relational DBMS scenario?

I/O Cost Calculation using Index Nested Loops Join Algorithm

Data:
Stu relation tuples: 6,500
Enr relation tuples: 120,000
Index search cost: 3-page I/O

Calculation:
For each tuple in Stu (6,500 I/Os): For each tuple, perform a search through the index (3-page I/O) and retrieve matching tuples from Enr.
Total I/O cost: 6,500 * 3 = 19,500 I/Os

Therefore, the I/O cost of joining the Students and EnrollsIn relations using the index nested loops join algorithm is 19,500 I/Os.

What is the I/O cost of joining the Stu and Enr relations using the page-oriented nested loops join algorithm in a relational DBMS scenario?

I/O Cost Calculation using Page-Oriented Nested Loops Join Algorithm

Data:
Stu relation tuples: 6,500
Enr relation tuples: 120,000
Page size: 25 tuples for Stu, 125 tuples for Enr
Assumption: No records span multiple pages

Calculation:
For each page in Stu (260 I/Os): For each page, read the corresponding pages from Enr and perform the join operation.
Total I/O cost: 260 * (120,000 / 125) = 249,860 I/Os

Therefore, the I/O cost of joining the Stu and Enr relations using the page-oriented nested loops join algorithm is 249,860 I/Os.

← How insufficient testing can lead to program errors and system failures Calculating the area of a triangle a reflective journey →