
DatabaseManagementSystems3ed,R.RamakrishnanandJ.Gehrke 1
RelationalQueryOptimization
Chapter15
DatabaseManagementSystems3ed,R.RamakrishnanandJ.Gehrke 2
HighlightsofSystemROptimizer
Impact:
Mostwidelyusedcurrently;wo rkswellfor<10joins.
Costestimation:Approximateartatbest.
Statistics,maintainedinsystemcatalogs,usedtoestimate
costofoperationsandresultsizes.
ConsiderscombinationofCPUandI/Ocosts.
PlanSpace:Toolarge,mustbepruned.
Onlythespaceofleft-deepplansisconsidered.
• Left-deepplansallow outputofeachoperatortobepipelined into
thenextoperatorwitho utstoringitinatempora ryrelation.
Cartesianproductsavoided.
DatabaseManagementSystems3ed,R.RamakrishnanandJ.Gehrke 3
OverviewofQueryOptimization
Plan:TreeofR.A.ops,withchoiceof alg foreachop.
Eachoperatortypicallyimplementedusinga`pull’
interface:whenanoperatoris`pulled’forthenextoutput
tuples,it`pulls’onitsinputsandcomputesthem.
Twomainissues:
Foragivenquery,whatplansareconsidered?
• Algorithmtosearchplan spaceforcheapest(estimated)plan.
Howisthecostofaplanestimated?
Ideally:Wanttofindbestplan.Practically:Avoid
worstplans!
WewillstudytheSystemRapproach.