SQL Process Flow

From Robs_Wiki
Revision as of 22:06, 21 February 2020 by Qadmin wiki (talk | contribs) (Step 1 Statement is parsed)
Jump to: navigation, search

Step 1 Statement is parsed

The user issues a statement and the statement is parsed by the database. When an application issues a SQL statement, the application makes a parse call to the database to prepare the statement for execution. The parse call opens or creates a cursor, which is a handle for the session-specific private SQL area that holds a parsed SQL statement and other processing information. The cursor and private SQL area are in the program global area (PGA).
The parse call involves 3 steps:

  • syntax check (no errors in SQL statement)
  • semantics check (do the objects actually exist)
  • shared pool check (to determine if the statement is already in the shared pool so it can skip resource-intensive steps of statement processing.) SQL statements are hashed and this hash (SQL_ID) is checked.
    • If the statement is not in the shared pool, a hard parse occurs: During the hard parse, the database accesses the library cache and data dictionary cache numerous times to check the data dictionary. When the database accesses these areas, it uses a serialization device called a latch on required objects so that their definition does not change. Latch contention increases statement execution time and decreases concurrency.