پاورپوینت کامل Chapter 14: Query Optimization 68 اسلاید در PowerPoint


در حال بارگذاری
10 جولای 2025
پاورپوینت
17870
4 بازدید
۷۹,۷۰۰ تومان
خرید

توجه : این فایل به صورت فایل power point (پاور پوینت) ارائه میگردد

 پاورپوینت کامل Chapter 14: Query Optimization 68 اسلاید در PowerPoint دارای ۶۸ اسلاید می باشد و دارای تنظیمات کامل در PowerPoint می باشد و آماده ارائه یا چاپ است

شما با استفاده ازاین پاورپوینت میتوانید یک ارائه بسیارعالی و با شکوهی داشته باشید و همه حاضرین با اشتیاق به مطالب شما گوش خواهند داد.

لطفا نگران مطالب داخل پاورپوینت نباشید، مطالب داخل اسلاید ها بسیار ساده و قابل درک برای شما می باشد، ما عالی بودن این فایل رو تضمین می کنیم.

توجه : در صورت  مشاهده  بهم ریختگی احتمالی در متون زیر ،دلیل ان کپی کردن این مطالب از داخل فایل می باشد و در فایل اصلی پاورپوینت کامل Chapter 14: Query Optimization 68 اسلاید در PowerPoint،به هیچ وجه بهم ریختگی وجود ندارد


بخشی از مطالب داخلی اسلاید ها

پاورپوینت کامل Chapter 14: Query Optimization 68 اسلاید در PowerPoint

اسلاید ۴: Introduction (Cont.)Relations generated by two equivalent expressions have the same set of attributes and contain the same set of tuplesalthough their tuples/attributes may be ordered differently.

اسلاید ۵: Introduction (Cont.)Generation of query-evaluation plans for an expression involves several steps:Generating logically equivalent expressions using equivalence rules.Annotating resultant expressions to get alternative query plansChoosing the cheapest plan based on estimated costThe overall process is called cost based optimization.

اسلاید ۶: Transformation of Relational ExpressionsTwo relational algebra expressions are said to be equivalent if on every legal database instance the two expressions generate the same set of tuplesNote: order of tuples is irrelevantIn SQL, inputs and outputs are multisets of tuplesTwo expressions in the multiset version of the relational algebra are said to be equivalent if on every legal database instance the two expressions generate the same multiset of tuplesAn equivalence rule says that expressions of two forms are equivalentCan replace expression of first form by second, or vice versa

اسلاید ۷: Equivalence Rules1.Conjunctive selection operations can be deconstructed into a sequence of individual selections. 2.Selection operations are commutative. 3.Only the last in a sequence of projection operations is needed, the others can be omitted. Selections can be combined with Cartesian products and theta joins.(E1 X E2) = E1 E2 1(E1 2 E2) = E1 1 2 E2

اسلاید ۸: Equivalence Rules (Cont.)5.Theta-join operations (and natural joins) are commutative. E1 E2 = E2 E16.(a) Natural join operations are associative: (E1 E2) E3 = E1 (E2 E3) (b) Theta joins are associative in the following manner: (E1 1 E2) 2 3 E3 = E1 2 3 (E2 2 E3) where 2 involves attributes from only E2 and E3.

اسلاید ۹: Pictorial Depiction of Equivalence Rules

اسلاید ۱۰: Equivalence Rules (Cont.)7.The selection operation distributes over the theta join operation under the following two conditions: (a) When all the attributes in 0 involve only the attributes of one of the expressions (E1) being joined. 0E1 E2) = (0(E1)) E2 (b) When 1 involves only the attributes of E1 and 2 involves only the attributes of E2. 1 E1 E2) = (1(E1)) ( (E2))

اسلاید ۱۱: Equivalence Rules (Cont.)8.The projections operation distributes over the theta join operation as follows:(a) if involves only attributes from L1 L2: (b) Consider a join E1 E2. Let L1 and L2 be sets of attributes from E1 and E2, respectively. Let L3 be attributes of E1 that are involved in join condition , but are not in L1 L2, and let L4 be attributes of E2 that are involved in join condition , but are not in L1 L2.))(())(()(21212121EEEELLLL=Eqq)))(())((()(212142312121EEEELLLLLLLLEEEE=qq

اسلاید ۱۲: Equivalence Rules (Cont.)The set operations union and intersection are commutative E1 E2 = E2 E1 E1 E2 = E2 E1 (set difference is not commutative).Set union and intersection are associative. (E1 E2) E3 = E1 (E2 E3) (E1 E2) E3 = E1 (E2 E3)The selection operation distributes over , and –. (E1 – E2) = (E1) – (E2) and similarly for and in place of – Also: (E1 – E2) = (E1) – E2 and similarly for in place of –, but not for 12.The projection operation distributes over union L(E1 E2) = (L(E1)) (L(E2))

اسلاید ۱۳: Transformation ExampleQuery: Find the names of all customers who have an account at some branch located in Brooklyn. customer_name(branch_city = “Brooklyn” (branch (account depositor)))Transformation using rule 7a. customer_name ((branch_city =“Brooklyn” (branch)) (account depositor))Performing the selection as early as possible reduces the size of the relation to be joined.

اسلاید ۱۴: Example with Multiple TransformationsQuery: Find the names of all customers with an account at a Brooklyn branch whose account balance is over $1000. customer_name((branch_city = “Brooklyn” balance > 1000 (branch (account depositor)))Transformation using join associatively (Rule 6a): customer_name((branch_city = “Brooklyn” balance > 1000 (branch account)) depositor) Second form provides an opportunity to apply the “perform selections early” rule, resulting in the subexpression branch_city = “Brooklyn” (branch) balance > 1000 (account)Thus a sequence of transformations can be useful

اسلاید ۱۵: Multiple Transformations (Cont.)

اسلاید ۱۶: Projection Operation ExampleWhen we compute(branch_city = “Brooklyn” (branch) account ) we obtain a relation whose schema is: (branch_name, branch_city, assets, account_number, balance)Push projections using equivalence rules 8a and 8b; eliminate unneeded attributes from intermediate results to get: customer_name (( account_number ( (branch_city = “Brooklyn” (branch) account )) depositor )Performing the projection as early as possible reduces the size of the relation to be joined. customer_name((branch_city = “Brooklyn” (branch) account) depositor)

اسلاید ۱۷: Join Ordering ExampleFor all relations r1, r2, and r3,(r1 r2) r3 = r1 (r2 r3 )If r2 r3 is quite large and r1 r2 is small, we choose (r1 r2) r3 so that we compute and store a smaller temporary relation.

اسلاید ۱۸: Join Ordering Example (Cont.)Consider the expressioncustomer_name ((branch_city = “Brooklyn” (branch)) (account depositor))Could compute account depositor first, and join result with branch_city = “Brooklyn” (branch) but account depositor is likely to be a large relation.Only a small fraction of the bank’s customers are likely to have accounts in branches located in Brooklyn it is better to compute branch_city = “Brooklyn” (branch) accountfirst.

اسلاید ۱۹: Enumeration of Equivalent ExpressionsQuery optimizers use equivalence rules to systematically generate expressions equivalent to the given expressionConceptually, generate all equivalent expressions by repeatedly executing the following step until no more expressions can be found: for each expression found so far, use all applicable equivalence rules add newly generated expressions to the set of expressions found so farThe above approach is very expensive in space and timeSpace requirements reduced by sharing common subexpressions:when E1 is generated from E2 by an equivalence rule, usually only the top level of the two are different, subtrees below are the same and can be sharedE.g. when applying join associativityTime requirements are reduced by not generating all expressionsMore details shortly

اسلاید ۲۰: Cost EstimationCost of each operator computer as described in Chapter 13Need statistics of input relationsE.g. number of tuples, sizes of tuplesInputs can be results of sub-expressionsNeed to estimate statistics of expression resultsTo do so, we require additional statisticsE.g. number of distinct values for an attributeMore on cost estimation later

اسلاید ۲۱: Evaluation PlanAn evaluation plan defines exactly what algorithm is used for each operation, and how the execution of the operations is coordinated.

اسلاید ۲۲: Choice of Evaluation PlansMust consider the interaction of evaluation techniques when choosing evaluation plans: choosing the cheapest algorithm for each operation independently may not yield best overall algorithm. E.g.merge-join may be costlier than hash-join, but may provide a sorted output which reduces the cost for an outer level aggregation.nested-loop join may provide opportunity for pipeliningPractical query optimizers incorporate elements of the following two broad approaches:1.Search all the plans and choose the best plan in a cost-based fashion.2. Uses heuristics to choose a plan.

اسلاید ۲۳: Cost-Based OptimizationConsider finding the best join-order for r1 r2 . . . rn.There are (2(n – ۱))!/(n – ۱)! different join orders for above expression. With n = 7, the number is 665280, with n = 10, the number is greater than 176 billion!No need to generate all the join orders. Using dynamic programming, the least-cost join order for any subset of {r1, r2, . . . rn} is computed only once and stored for future use.

اسلاید ۲۴: Dynamic Programming in OptimizationTo find best join tree for a set of n relations:To find best plan for a set S of n relations, consider all possible plans of the form: S1 (S – S1) where S1 is any non-empty subset of S.Recursively compute costs for joining subsets of S to find the cost of each plan. Choose the cheapest of the 2n – ۱ alternatives.When plan for any subset is computed, store it and reuse it when it is required again, instead of recomputing itDynamic programming

اسلاید ۲۵: Join Order Optimization Algorithmprocedure findbestplan(S) if (bestplan[S].cost ) return bestplan[S] // else bestplan[S] has not been computed earlier, compute it now if (S contains only 1 relation) set bestplan[S].plan and bestplan[S].cost based on the best way of accessing S else for each non-empty subset S1 of S such that S1 S P1= findbestplan(S1) P2= findbestplan(S – S1) A = best algorithm for joining results of P1 and P2 cost = P1.cost + P2.cost + cost of A if cost < bestplan[S].cost bestplan[S].cost = cost bestplan[S].plan = “execute P1.plan; execute P2.plan; join results of P1 and P2 using A” return bestplan[S]

اسلاید ۲۶: Left Deep Join TreesIn left-deep join trees, the right-hand-sid

  راهنمای خرید:
  • همچنین لینک دانلود به ایمیل شما ارسال خواهد شد به همین دلیل ایمیل خود را به دقت وارد نمایید.
  • ممکن است ایمیل ارسالی به پوشه اسپم یا Bulk ایمیل شما ارسال شده باشد.
  • در صورتی که به هر دلیلی موفق به دانلود فایل مورد نظر نشدید با ما تماس بگیرید.