Steps for Oracle to execute SQL query statements
The SQL query statement executed by Oracle is different from that of other statements. If the query statement is successfully executed, the query result is returned. Other types of SQL statements only return successful or failed execution information. Oracle processes query statements in three major stages: parse, execute, and fetch ).
- Parse: during compilation, the server process puts the SQL statement content into the library cache of the shared pool, and completes the following processing:
- First, check whether the same SQL statement is included in the Shared Pool. If not, perform subsequent processing.
- Check whether the SQL statement syntax is correct.
- View the data dictionary to check the definitions of tables and columns related to SQL statements.
- Add a compilation lock (parse locks) to the objects operated by the SQL statement so that the definition of these objects will not change during the compilation statement.
- Check whether the user has permissions on the objects referenced by the SQL statement.
- Generate the SQL Execution Plan.
- Place SQL statements and execution plans in the shared SQL zone.
- Execute: The compiled SQL statement is executed by the Oracle server process.
- Fetch: the Oracle server process selects the desired data row, sorts it as needed, and finally returns the result to the user process.