欢迎来到天天文库
浏览记录
ID:51969273
大小:1.06 MB
页数:57页
时间:2020-03-26
《数据库系统概念全套配套课件PPT ch12.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Chapter12:QueryProcessingChapter12:QueryProcessingOverviewMeasuresofQueryCostSelectionOperationSortingJoinOperationOtherOperationsEvaluationofExpressionsBasicStepsinQueryProcessing1.Parsingandtranslation2.Optimization3.EvaluationBasicStepsinQueryProcessing(Cont.)Parsingandtransl
2、ationtranslatethequeryintoitsinternalform.Thisisthentranslatedintorelationalalgebra.Parsercheckssyntax,verifiesrelationsEvaluationThequery-executionenginetakesaquery-evaluationplan,executesthatplan,andreturnstheanswerstothequery.BasicStepsinQueryProcessing:OptimizationArelationa
3、lalgebraexpressionmayhavemanyequivalentexpressionsE.g.,salary75000(salary(instructor))isequivalenttosalary(salary75000(instructor))EachrelationalalgebraoperationcanbeevaluatedusingoneofseveraldifferentalgorithmsCorrespondingly,arelational-algebraexpressioncanbeevaluatedinm
4、anyways.Annotatedexpressionspecifyingdetailedevaluationstrategyiscalledanevaluation-plan.E.g.,canuseanindexonsalarytofindinstructorswithsalary<75000,orcanperformcompleterelationscananddiscardinstructorswithsalary75000BasicSteps:Optimization(Cont.)QueryOptimization:Amongstallequ
5、ivalentevaluationplanschoosetheonewithlowestcost.Costisestimatedusingstatisticalinformationfromthedatabasecataloge.g.numberoftuplesineachrelation,sizeoftuples,etc.InthischapterwestudyHowtomeasurequerycostsAlgorithmsforevaluatingrelationalalgebraoperationsHowtocombinealgorithmsf
6、orindividualoperationsinordertoevaluateacompleteexpressionInChapter14Westudyhowtooptimizequeries,thatis,howtofindanevaluationplanwithlowestestimatedcostMeasuresofQueryCostCostisgenerallymeasuredastotalelapsedtimeforansweringqueryManyfactorscontributetotimecostdiskaccesses,CPU,or
7、evennetworkcommunicationTypicallydiskaccessisthepredominantcost,andisalsorelativelyeasytoestimate.MeasuredbytakingintoaccountNumberofseeks*average-seek-costNumberofblocksread*average-block-read-costNumberofblockswritten*average-block-write-costCosttowriteablockisgreaterthancostt
8、oreadablockdataisreadbackafterbeingwrittentoens
此文档下载收益归作者所有