Chapter12a - Database Management Systems, R. Ramakrishnan...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Database Management Systems, R. Ramakrishnan and J. Gehrke Evaluation of Relational Operations Chapter 12, Part A Database Management Systems, R. Ramakrishnan and J. Gehrke Relational Operations We will consider how to implement: Selection ( ) Selects a subset of rows from relation. Projection ( ) Deletes unwanted columns from relation. Join ( ) Allows us to combine two relations. Set-difference ( ) Tuples in reln. 1, but not in reln. 2. Union ( ) Tuples in reln. 1 and in reln. 2. Aggregation ( SUM, MIN , etc.) and GROUP BY Since each op returns a relation, ops can be composed ! After we cover the operations, we will discuss how to optimize queries formed by composing them. - Database Management Systems, R. Ramakrishnan and J. Gehrke Schema for Examples Similar to old schema; rname added for variations. Reserves: Each tuple is 40 bytes long, 100 tuples per page, 1000 pages. Sailors: Each tuple is 50 bytes long, 80 tuples per page, 500 pages. Sailors (sid : integer , sname: string, rating: integer, age: real) Reserves (sid : integer, bid : integer, day : dates , rname: string) Database Management Systems, R. Ramakrishnan and J. Gehrke Equality Joins With One Join Column In algebra: R S . Common! Must be carefully optimized. R S is large; so, R S followed by a selection is inefficient. Assume: M pages in R with p R tuples per page, N pages in S with p S tuples per page. (In our examples, R is Reserves and S is Sailors .) We will consider more complex join conditions later. Cost metric : # of I/Os. We will ignore output costs. SELECT * FROM Reserves R1, Sailors S1 WHERE R1.sid = S1.sid Database Management Systems, R. Ramakrishnan and J. Gehrke Simple Nested Loops Join For each tuple in the outer relation R, we scan the entire inner relation S. Cost: M + ( p R * M) * N = 1000 + 100*1000*500 I/Os. Page-oriented Nested Loops join: For each page of R, get each page of S, and write out matching pairs of tuples <r, s>, where r is in R- page and S is in S-page....
View Full Document

Page1 / 18

Chapter12a - Database Management Systems, R. Ramakrishnan...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online