This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Optimization (43 of 64) 3. Generate Hashtable H(T) with the cost of B(T); 4. Read R ⋈ S with the cost of B(R ⋈ S) and then join with H(T). Then write into the disk with the cost of B(R ⋈ S ⋈ T). 5. Generate Hashtable H(U) with the cost of B(U); 6. Read R ⋈ S ⋈ T with the cost of B(R ⋈ S ⋈ T) and then join with H(U). Then output the result. The total cost and the memory will be shown in the next slide. As the steps shown in the previous slide, Materialize Intermediate Results Between Operators
• Given B(R), B(S), B(T), B(U) Cost = B(R) + B(S) + B(T) + B(U) + 2*B(R ⋈ • What is the total cost of the plan ? S) + B(R ⋈ S ⋈ T). • Cost = Memory = Max(B(S), B(T), B(U)). • How much main memory do we need ?
• M = (As only one tuple is read each time, B(R) should not be included when calculating the memory) Completing Physical Query Plan (3 of 13) Query Optimization (44 of 64) Steps: Pipeline Between Operators 1. Generate Hashtable H(S) with the cost of B(S); ⋈
⋈
⋈
R U
T S HashTable1 ß། S
HashTable2 ß། T
HashTable3 ß། U
repeat read(R, x)
y ß། join(HashTable1, x) z ß། join(HashTable2, y)
u ß། join(HashTable3, z)
write(Answer, u) 2. Generate Hashtable H(T) with the cost of B(T); 3. Generate Hashtable H(U) with the cost of B(U); How much main memory do we need ? M = Completing Physical Query Plan (4 of 13) Query Optimization (45 of 64) 4. Read every tuple of R and join with H(S). Then join with H(T). Then join with H(U) Then output the answer. Pipeline Between Operators As the steps shown in the p...
View Full
Document
 Fall '08
 Staff

Click to edit the document details