Query Processing is a procedure of transforming a high-level query (such as SQL) into a correct and efficient execution plan expressed in low-level language. A query processing select a most appropriate plan that is used in responding to a database request. When a database system receives a query for update or retrieval of information, it goes through a series of compilation steps, called execution plan. In the first phase called syntax checking phase, the system parses the query and checks that it follows the syntax rules or not. It then matches the objects in the query syntax with
the view tables and columns listed in the system table. Finally it performs the appropriate query modification. During this phase the system validates the user privileges and that the query does not disobey any integrity rules. The execution plan is finally execute to generate a response. So query processing is a stepwise process.
Query processing includes translation of high-level queries into low-level expressions that can be used at the physical level of the file system, query optimization and actual execution of the query to get the result. It is a three-step process that consists of parsing and translation, optimization and execution of the query submitted by the user .These steps are discussed below:
- Parsing and translation
- Optimization
- Evaluation
- Parsing and translation
Check syntax and verify relations. Translate the query into its internal form. This is then translated into relational algebra. - Optimization
The primary goal of query optimization is of choosing an efficient execution strategy for processing a query. The query optimizer attempts to minimize the use of certain resources (mainly the number of I/O and CPU time) by selecting a best execution plan (access plan). A query
optimization start during the validation phase by the system to validate the user has appropriate privileges. Simply, generate an optimal evaluation plan (with lowest cost) for the query plan is called optimization.
- Evaluation
The query-execution engine takes an (optimal) evaluation plan, executes that plan, and returns the
answers to the query.