Home » Oracle » Oracle Database » How the sql query is executed in Oracle

How the sql query is executed in Oracle

When a user issues a sql query to the Oracle engine, the below illustration is worked out

How the sql query is executed in Oracle

Here is how this works

(1) Users issue SQL statements via your client tool SQL*Plus or SQL Developer
(2) If the statement has been previously executed and parsed, then Oracle simply executes the stored execution plan.
(3) If the statement is not present in the shared pool, Oracle handles your request by first allocating space in memory, called a cursor, in the shared pool of the System Global Area (SGA), and then Oracle hard parses the statement to generate the execution plan, stores the statement in the library cache and then executes the derived plan.
(4) Now Oracle finds out the blocks of data that contain the rows that answer your query.
(5)If Oracle determines that the data blocks you need are already in the buffer cache. then Oracle will execute a logical read to retrieve your rows.
(6) if the blocks needed are not already in the buffer cache, Oracle must make a request to the operating system to retrieve the required blocks. Once the operating system completes this action, then Oracle will place the blocks into the buffer cache and retrieve the rows that satisfy your query.
(7)Rows satisfying the query are returned to the users

I hope you like this explanation

Related Articles

  1. sql tuning in Oracle
  2. Nested Loop Join in Oracle
  3. Hash join in Oracle
See also  how to find if the sql is using the sql profile

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top