A query expresses in a high-level language like SQL must first be scanned, parsed, and validated. • Once the above steps are completed, an internal representation of the query is created. Typically this is either a tree or graph structure, called a query tree or query graph. • Using the query tree or query graph the RDBMS must devise an execution strategy for retrieving the results from the internal files. • For all but the most simple queries, several different execution strategies are possible. The process of choosing a suitable execution strategy is called query optimization | COP 4710: Database Systems Spring 2004 Query Processing and Optimization BÀI 15, 1,5 ngày School of Electrical Engineering and Computer Science University of Central Florida Instructor : Mark Llewellyn markl@ CC1 211, 823-2790 Phd, MS, Under Query Processing and Optimization A query expresses in a high-level language like SQL must first be scanned, parsed, and validated. Once the above steps are completed, an internal representation of the query is created. Typically this is either a tree or graph structure, called a query tree or query graph. Using the query tree or query graph the RDBMS must devise an execution strategy for retrieving the results from the internal files. For all but the most simple queries, several different execution strategies are possible. The process of choosing a suitable execution strategy is called query optimization. The Steps in Query Processing Scanning, Parsing, and Validation query in a high-level . | COP 4710: Database Systems Spring 2004 Query Processing and Optimization BÀI 15, 1,5 ngày School of Electrical Engineering and Computer Science University of Central Florida Instructor : Mark Llewellyn markl@ CC1 211, 823-2790 Phd, MS, Under Query Processing and Optimization A query expresses in a high-level language like SQL must first be scanned, parsed, and validated. Once the above steps are completed, an internal representation of the query is created. Typically this is either a tree or graph structure, called a query tree or query graph. Using the query tree or query graph the RDBMS must devise an execution strategy for retrieving the results from the internal files. For all but the most simple queries, several different execution strategies are possible. The process of choosing a suitable execution strategy is called query optimization. The Steps in Query Processing Scanning, Parsing, and Validation query in a high-level language intermediate form of the query Query Optimizer execution plan Query Code Generator code to execute query Runt-time Database Processor query results Query Optimization The term query optimization may be somewhat misleading. Typically, no attempt is made to achieve an optimal query execution strategy overall – merely a reasonably efficient strategy. Finding an optimal strategy is usually too time consuming except for very simple queries and for these it usually doesn’t matter. Queries may be “hand-tuned” for optimal performance, but this is rare. Each RDBMS will typically maintain a number of general database access algorithms that implement basic relational operations such as select and join. Hybrid combinations of relational operations also typically exist. Query Optimization (cont.) Only execution strategies that can be implemented by the DBMS access algorithms and which apply to the particular database in question can be considered by the query optimizer. There are two basic