Proactive Re-Optimization

23
Proactive Re- Optimization Shivnath Babu, Pedo Bizarro, David DeWitt SIGMOD 2005 (presented by Steve Blundy & Oleg Rekutin)

description

Proactive Re-Optimization. Shivnath Babu, Pedo Bizarro, David DeWitt SIGMOD 2005 (presented by Steve Blundy & Oleg Rekutin). Overview. What’s wrong with reactive? Proactive via 3 core techniques Experiments. Reactive Re-optimization. - PowerPoint PPT Presentation

Transcript of Proactive Re-Optimization

Page 1: Proactive Re-Optimization

Proactive Re-Optimization

Shivnath Babu, Pedo Bizarro, David DeWitt

SIGMOD 2005

(presented by Steve Blundy & Oleg Rekutin)

Page 2: Proactive Re-Optimization

Overview

What’s wrong with reactive? Proactive via 3 core techniques Experiments

Page 3: Proactive Re-Optimization

Reactive Re-optimization

0

50

100

150

200

250

300

350

400

450

500

550

R S

select from R, S where R.a=S.a and R.b>K1 and R.c>K2σ

buffer

σ(R) actual

σ(R) estimated

A:

B:

!

!

Page 4: Proactive Re-Optimization

Single-Point Limitation

A:

B:

Page 5: Proactive Re-Optimization

Limited Information for Re-opt

select from R, S, T where R.a=S.a and S.b=T.b and R.c>K1 and R.d=K2

0

20

40

60

80

100

120

140

160

180

200

R S T

σ(R) act

σ(R) est!

!!

Page 6: Proactive Re-Optimization

Choosing a plan

1. Compute bounding boxes

2. Use them to generate robust plans and switchable plans

3. Use randomization to collect statistics

Page 7: Proactive Re-Optimization

Bounding Boxes

“Representing Uncertainty in Statistics” Are the upper and lower bounds for each

estimated statistic

Page 8: Proactive Re-Optimization

Bounding Boxes

Page 9: Proactive Re-Optimization

Optimal Plan

1 Plan is optimal for all 3 points

Choice is easy

Optimal Plan

0 50 100 150 200 250 300 350

Page 10: Proactive Re-Optimization

Robust Plan

1 plan is, or close to, optimal for all 3 points

1 plan can be safely chosen

Robust Plans

0 50 100 150 200 250 300 350

Page 11: Proactive Re-Optimization

Switchable Plan

There is a plan with close to optimal cost plan at each point

Additional Requirements The decision can be

deferred Actual statistics lie must

within bounding box It is possible to switch

between the plans

Switchable

0 50 100 150 200 250 300 350

Page 12: Proactive Re-Optimization

What is a “Switchable” Plan

“Any two members of a switchable plan are said to be switchable with each other.”

Page 13: Proactive Re-Optimization

Collecting statistics

1. Each operator collects some % in buffer2. The eos(f) is emitted & statistics are calculated3. Plan is chosen from switch plan members or

re-optimization is run4. Query processing proceeds

Page 14: Proactive Re-Optimization

Questions

Prevalence of switchable plans vs. case 4 How good is Rho at preventing re-

optimizations How is Rho affected by large # estimates

Page 15: Proactive Re-Optimization

Experiments

Traditional Optimizer (TRAD) Validity-Ranges Optimizer (VRO)

Page 16: Proactive Re-Optimization

2-Way Join Queries: Robust

0

40

80

120

160

200

240

280

320

360

400

440

A C

σ(A) est

Page 17: Proactive Re-Optimization

2-Way Join Queries: Switchable

0

40

80

120

160

200

240

280

320

360

400

440

A C

σ(A) est

σ(A) b. box

Page 18: Proactive Re-Optimization

3-Way Join Example

Shows the use of a Switchable Plan Some re-optimization still necessary

Page 19: Proactive Re-Optimization

Pt |σ1(A)| TRAD VRO Rio Opt

A 6 MB P17a Inside range, P17a Outside box, re-optimize, P17a P17a

B 80 MB P17a Inside range, P17a Inside box, P17a P17a

C 160 MB P17a Outside range, re-optimize, P17d

Inside box, P17d P17b

D 310 MB P17a Outside range, re-optimize, P17d

Outside box, re-optimize, P17b P17b

Page 20: Proactive Re-Optimization
Page 21: Proactive Re-Optimization

Correlation-Based Mistakes

Page 22: Proactive Re-Optimization

Query Complexity

Page 23: Proactive Re-Optimization

Conclusion

Rho refines statistics and uses switchable plans to forestall re-optimizations and prevent partial data loss

Questions?