Download presentation
Presentation is loading. Please wait.
1
ONE PASS ALGORITHM PRESENTED BY: PRADHYUMAN RAOL ID : 114 Instructor: Dr T.Y. LIN
2
Agenda One Pass algorithm Tuple-at-a-Time Unary Operators Binary Operations
3
One-Pass Algorithms One Pass Algorithm: Some methods involve reading the data only once from disk. They work only when at least one of the arguments of the operation fits in main memory.
4
Tuple-at-a-Time We read the blocks of R one at a time into an input buffer, perform the operation on the tuple, and more the selected tuples or the projected tuples to the output buffer. Examples: Selection & Projection
5
Tuple at a time Diagram Input bufferOutput buffer Unary operator R
6
Unary Operators The unary operations that apply to relations as a whole, rather than to one tuple at a time. Duplicate Elimination (R) :Check whether that tuple is already there or not. M= Main memory B( (R))= Size of Relation R Assumption: B( (R)) <= M
7
Unary Operators Grouping : A grouping operation gives us zero or more grouping attributes and presumably one or more accumulated value or values for each aggregation. Min or Max Count – For any count aggregation, add one for each tuple of the group that is seen. Sum- add the value of attribute a to the accumulated sum for its group provided, a is not NULL. Average
8
Binary Operations Set Union- We read S into M-1 buffers of main memory and build a search structure whose search key is the entire tuple. Set Intersection- Read S into M-1 buffers and build a search structure with full tuples as the search key.
9
Continued… Set Difference Bag Intersection Bag Difference Product Natural Join- To compute the Natural Join we have to do the following: 1.Read all the tuples of S form them into a main memory search structures with the attributes of Y as the search key. Use M-1 block of memory for this purpose.
10
Continued… 2. Read each block of R into the one remaining main memory buffer. For each tuple t of R, find the tuples of S that agree with t on all attributes of Y, using the search Structure. For each matching tuple S, form a tuple by joining it with t, and move the resulting tuple to the output.
11
Thank You
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.