Steps for processing SQL statements in Oracle Database SQL statements are as follows: www.2cto.com 1. parsing 1. When parsing SQL statements, run the syntax check first. Check whether the statement complies with the specification. 2. At this stage of semantic check, the database determines whether the SQL statement has the corresponding meaning, such as whether the table or field involved in the SQL statement exists. 3. The shared pool check (shared SQL area check) database executes a shared pool check to determine whether it can skip several steps in the resource set. Then, the database uses the hash algorithm to generate hash values for each SQL statement. That is, SQL _id v $ SQL. SQL _id. (when the SQL statement shared pool check matches the same hash value, other checks are required, such as semantic check and system environment, for example, different database parameters, different users, and different session environments may be affected.) 2. Optimization in the SQL statement optimization stage can be divided into the following steps. 1. the optimizer receives parsed statements and generates a set of possible access paths based on SQL statements and hints execution plans. the optimizer evaluates the cost of each execution plan based on the statistics in the data dictionary. Cost is the estimated value. 3. Compare the optimizer and select the execution plan with the lowest cost. Send the query plan to the row source producer. Shows the three major components of the optimizer:
A detailed description of this part will be provided in future articles. 3. row source generation it receives the best execution plan from the optimizer and generates a recursive plan called a query plan. Recursive plan is a binary program. When executed by SQL vm, The result set is generated. The query plan removes a table from a complex step. A rowset is returned for each step. The row in these rowsets can be used by the next step or the last step. It is actually an operable result set ). It can be a view, a connected result set, or a classification operation. Row source generator generates a row source tree, which is a collection of row sources. The row source tree has the following information: 1. Sequence of tables referenced by a statement 2. Access methods for each table mentioned in a statement 3. Statement of impact of operations on a table connection method. 4. Data operations, such as filtering, sorting, and aggregation. 4. During execution, the SQL engine executes each row source in the tree generated by the row source generator.