پاورپوینت کامل Chapter 13: Query Processing 61 اسلاید در PowerPoint


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

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

 پاورپوینت کامل Chapter 13: Query Processing 61 اسلاید در PowerPoint دارای ۶۱ اسلاید می باشد و دارای تنظیمات کامل در PowerPoint می باشد و آماده ارائه یا چاپ است

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

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

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


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

پاورپوینت کامل Chapter 13: Query Processing 61 اسلاید در PowerPoint

اسلاید ۴: Basic Steps in Query Processing (Cont.)Parsing and translationtranslate the query into its internal form. This is then translated into relational algebra.Parser checks syntax, verifies relationsEvaluationThe query-execution engine takes a query-evaluation plan, executes that plan, and returns the answers to the query.

اسلاید ۵: Basic Steps in Query Processing : OptimizationA relational algebra expression may have many equivalent expressionsE.g., balance2500(balance(account)) is equivalent to balance(balance2500(account))Each relational algebra operation can be evaluated using one of several different algorithmsCorrespondingly, a relational-algebra expression can be evaluated in many ways. Annotated expression specifying detailed evaluation strategy is called an evaluation-plan.E.g., can use an index on balance to find accounts with balance < 2500,or can perform complete relation scan and discard accounts with balance 2500

اسلاید ۶: Basic Steps: Optimization (Cont.)Query Optimization: Amongst all equivalent evaluation plans choose the one with lowest cost. Cost is estimated using statistical information from the database cataloge.g. number of tuples in each relation, size of tuples, etc.In this chapter we studyHow to measure query costsAlgorithms for evaluating relational algebra operationsHow to combine algorithms for individual operations in order to evaluate a complete expressionIn Chapter 14We study how to optimize queries, that is, how to find an evaluation plan with lowest estimated cost

اسلاید ۷: Measures of Query CostCost is generally measured as total elapsed time for answering queryMany factors contribute to time costdisk accesses, CPU, or even network communicationTypically disk access is the predominant cost, and is also relatively easy to estimate. Measured by taking into accountNumber of seeks * average-seek-costNumber of blocks read * average-block-read-costNumber of blocks written * average-block-write-costCost to write a block is greater than cost to read a block data is read back after being written to ensure that the write was successful

اسلاید ۸: Measures of Query Cost (Cont.)For simplicity we just use the number of block transfers from disk and the number of seeks as the cost measurestT – time to transfer one blocktS – time for one seekCost for b block transfers plus S seeks b * tT + S * tS We ignore CPU costs for simplicityReal systems do take CPU cost into accountWe do not include cost to writing output to disk in our cost formulaeSeveral algorithms can reduce disk IO by using extra buffer space Amount of real memory available to buffer depends on other concurrent queries and OS processes, known only during executionWe often use worst case estimates, assuming only the minimum amount of memory needed for the operation is availableRequired data may be buffer resident already, avoiding disk I/OBut hard to take into account for cost estimation

اسلاید ۹: Selection OperationFile scan – search algorithms that locate and retrieve records that fulfill a selection condition.Algorithm A1 (linear search). Scan each file block and test all records to see whether they satisfy the selection condition.Cost estimate = br block transfers + 1 seekbr denotes number of blocks containing records from relation rIf selection is on a key attribute, can stop on finding recordcost = (br /2) block transfers + 1 seekLinear search can be applied regardless of selection condition orordering of records in the file, or availability of indices

اسلاید ۱۰: Selection Operation (Cont.)A2 (binary search). Applicable if selection is an equality comparison on the attribute on which file is ordered. Assume that the blocks of a relation are stored contiguously Cost estimate (number of disk blocks to be scanned):cost of locating the first tuple by a binary search on the blockslog2(br) * (tT + tS)If there are multiple records satisfying selectionAdd transfer cost of the number of blocks containing records that satisfy selection condition Will see how to estimate this cost in Chapter 14

اسلاید ۱۱: Selections Using IndicesIndex scan – search algorithms that use an indexselection condition must be on search-key of index.A3 (primary index on candidate key, equality). Retrieve a single record that satisfies the corresponding equality condition Cost = (hi + 1) * (tT + tS)A4 (primary index on nonkey, equality) Retrieve multiple records. Records will be on consecutive blocksLet b = number of blocks containing matching recordsCost = hi * (tT + tS) + tS + tT * bA5 (equality on search-key of secondary index).Retrieve a single record if the search-key is a candidate keyCost = (hi + 1) * (tT + tS)Retrieve multiple records if search-key is not a candidate keyeach of n matching records may be on a different block Cost = (hi + n) * (tT + tS) Can be very expensive!

اسلاید ۱۲: Selections Involving ComparisonsCan implement selections of the form AV (r) or A V(r) by using a linear file scan or binary search, or by using indices in the following ways:A6 (primary index, comparison). (Relation is sorted on A)For A V(r) use index to find first tuple v and scan relation sequentially from thereFor AV (r) just scan relation sequentially till first tuple > v; do not use indexA7 (secondary index, comparison). For A V(r) use index to find first index entry v and scan index sequentially from there, to find pointers to records.For AV (r) just scan leaf pages of index finding pointers to records, till first entry > vIn either case, retrieve records that are pointed torequires an I/O for each record Linear file scan may be cheaper

اسلاید ۱۳: Implementation of Complex SelectionsConjunction: 1 2. . . n(r) A8 (conjunctive selection using one index). Select a combination of i and algorithms A1 through A7 that results in the least cost for i (r). Test other conditions on tuple after fetching it into memory buffer.A9 (conjunctive selection using multiple-key index). Use appropriate composite (multiple-key) index if available.A10 (conjunctive selection by intersection of identifiers). Requires indices with record pointers. Use corresponding index for each condition, and take intersection of all the obtained sets of record pointers. Then fetch records from fileIf some conditions do not have appropriate indices, apply test in memory.

اسلاید ۱۴: Algorithms for Complex SelectionsDisjunction:1 2 . . . n (r). A11 (disjunctive selection by union of identifiers). Applicable if all conditions have available indices. Otherwise use linear scan.Use corresponding index for each condition, and take union of all the obtained sets of record pointers. Then fetch records from fileNegation: (r)Use linear scan on fileIf very few records satisfy , and an index is applicable to Find satisfying records using index and fetch from file

اسلاید ۱۵: SortingWe may build an index on the relation, and then use the index to read the relation in sorted order. May lead to one disk block access for each tuple.For relations that fit in memory, techniques like quicksort can be used. For relations that don’t fit in memory, external sort-merge is a good choice.

اسلاید ۱۶: External Sort-MergeCreate sorted runs. Let i be 0 initially. Repeatedly do the following till the end of the relation: (a) Read M blocks of relation into memory (b) Sort the in-memory blocks (c) Write sorted data to run Ri; increment i. Let the final value of i be NMerge the runs (next slide)…..Let M denote memory size (in pages).

اسلاید ۱۷: External Sort-Merge (Cont.)Merge the runs (N-way merge). We assume (for now) that N < M. Use N blocks of memory to buffer input runs, and 1 block to buffer output. Read the first block of each run into its buffer pagerepeatSelect the first record (in sort order) among all buffer pagesWrite the record to the output buffer. If the output buffer is full write it to disk.Delete the record from its input buffer page. If the buffer page becomes empty then read the next block (if any) of the run into the buffer. until all input buffer pages are empty:

اسلاید ۱۸: External Sort-Merge (Cont.)If N M, several merge passes are required.In each pass, contiguous groups of M – 1 runs are merged. A pass reduces the number of runs by a factor of M -1, and creates runs longer by the same factor. E.g. If M=11, and there are 90 runs, one pass reduces the number of runs to 9, each 10 times the size of the initial runsRepeated passes are performed till all runs have been merged into one.

اسلاید ۱۹: Example: External Sorting Using Sort-Merge

اسلاید ۲۰: External Merge Sort (Cont.)Cost analysis:Total number of merge passes required: logM–۱(br/M).Block transfers for initial run creation as well as in each pass is 2brfor final pass, we don’t count write cost we ignore final write cost for all operations since the output of an operation may be sent to the parent operation without being written to diskThus total number of block transfers for external sorting: br ( 2 logM–۱(br / M) + 1)Seeks: next slide

اسلاید ۲۱: External Merge Sort (Cont.)Cost of seeksDuring run gener

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