![]() Though these techniques provide the best solution, it has an exponential time and space complexity owing to the large solution space. In these techniques, for a query, all possible query plans are initially generated and then the best plan is selected. Approaches to Query OptimizationĪmong the approaches for query optimization, exhaustive search and heuristics-based algorithms are mostly used. Once the query code is generated, the Execution Manager runs it and produces the results. It is the executable form of the query, whose form depends upon the type of the underlying operating system. For example, a selection operation can have an access path that gives details about the use of B tree index for selection.īesides, a query plan also states how the intermediate tables should be passed from one operator to the next, how temporary tables should be used and how operations should be pipelined/combined.Ĭode generation is the final step in query optimization. Access paths specify how the relational operations in the tree should be performed. A query plan is an extended query tree that includes access paths for all operations in the query tree. $$\pi_$įollowing is the query tree for the above query.Īfter the query tree is generated, a query plan is made. Let us consider the query as the following. This process continues for all internal nodes until the root node is executed and replaced by the result table.įor example, let us consider the following schemas − The node is then replaced by the result table. The root represents the query as a whole.ĭuring execution, an internal node is executed whenever its operand tables are available. The relational algebra operations are represented as the internal nodes. The tables of the query are represented as leaf nodes. Query optimization involves three steps, namely query tree generation, plan generation, and query plan code generation.Ī query tree is a tree data structure representing a relational algebra expression. Each block is then translated to equivalent relational algebra expression. If the query passes this step, the query is decomposed into smaller query blocks. Then it is parsed to look for syntactical errors and correctness of data types. Reduce the amount of memory and storage required for processing. Maximize system throughput (the number of requests that are processed in a given amount of time). Minimization of response time of query (time taken to produce the results to user’s query). In a centralized system, query processing is done with the following aim − In this chapter, we will look into query optimization in centralized system while in the next chapter we will study query optimization in a distributed system. Once the alternative access paths for computation of a relational algebra expression are derived, the optimal access path is determined. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |