Download presentation
Presentation is loading. Please wait.
Published byJulian Britton Barton Modified over 8 years ago
1
Fan Qi fan.qi@nus.edu.sg Database Lab 1, com1 #01-08 CS3223 Tutorial 8
2
Question 1.1 Emp (eid, sal, age, did) 20 byte/tuple 20k tuple Dept (did, projid, budget, status) 40 byte/tuple 5k tuple Proj (projid, code, report) 2k byte/tuple 1k tuple MEMORY: 4K byte/page12 pages What can we infer?
3
Question 1.1 Emp (eid, sal, age, did) 20 byte/tuple 20k tuple Dept (did, projid, budget, status) 40 byte/tuple 5k tuple Proj (projid, code, report) 2k byte/tuple 1k tuple MEMORY: 4K byte/page12 pages Q1: Find all employees with age = 30 Q2: Find all projects with code = 20 Which table should build Clustered B+ tree ? How to estimate the cost of B+ tree
4
Question 1.1 1 page can hold 200 tuples Date entries in unclustered B+ tree is more compact
5
Question 1.1
6
Question 1.2 (a) All plans: P1. Block nested loop join with Emp as outer relation. P2. Block nested loop join with Emp as inner relation. P3. Index nested-looop join with Emp as inner relation. P4. Sort merge join with Emp as outer relation. P5. Sort merge join with Emp as inner relation. P6. Hash join with Emp as build relation. P7. Hash join with Emp as probe relation. Cost(P1) ≥ Cost(P2) Cost(P4) ≥ Cost(P5) Cost(P6) ≥ Cost(P7)
7
Question 1.2 (a)
8
Question 1.2 (b) All plans: P1. Block nested loop join with Emp as outer relation. P2. Block nested loop join with Emp as inner relation. P3. Index nested-looop join with Emp as inner relation. P4. Sort merge join with Emp as outer relation. P5. Sort merge join with Emp as inner relation. P6. Hash join with Emp as build relation. P7. Hash join with Emp as probe relation.
9
Question 1.2 (c)
10
Question 3 Three Table Join Query Query plans: {E}, {D}, {P} {E,D}, {D,P} {E,D,P} For each sub query, there are multi plans P D E E P D
11
Question 3
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.