How SQL gets executed in Oracle
First the SQL is passed into a Hashing Algorithm and a Hash value is generated.The next step is Parsing of the SQL statement and generating Optimal execution plan.There are two types of parsing, Soft parse and Hard Parse.
Oracle will check whether the generated hash value already exist in the memory buffer. if itexist it will take the plan of the existing hash and executes , this is known assoft parsing.If the hash value does not exist, the new hashvalue is stored in the memory buffer and then the sql will be parsed. Thisis called as Hard Parsing.
Parsing involves Syntax check and Semantic Check.Once the Sql is parsed, the Optimizer willgenerate a Optimal Execution plan.Once the plan is generated, oracle SQL engine will execute the SQL based on the optimalexecution plan.
The Order of the various SQL Clause in a statement is as follows
1. First, the WHERE clause is applied as a filter to the data which comes the individual tables.
2. then if there is a JOIN, then the Join are executed in the most optimized way
3. then if there is a GROUP BY clause, the data is grouped based on the grouping column and aggregate functions are applied on the data and if a HAVING clause is there, it is applied to filter the grouped data
4. then SELECT is used to get the desired columns
5. if there is any analytical functions, it will be applied in the output
6. finally, ORDER BY Clause is applied to sort the data
Oracle will check whether the generated hash value already exist in the memory buffer. if itexist it will take the plan of the existing hash and executes , this is known assoft parsing.If the hash value does not exist, the new hashvalue is stored in the memory buffer and then the sql will be parsed. Thisis called as Hard Parsing.
Parsing involves Syntax check and Semantic Check.Once the Sql is parsed, the Optimizer willgenerate a Optimal Execution plan.Once the plan is generated, oracle SQL engine will execute the SQL based on the optimalexecution plan.
The Order of the various SQL Clause in a statement is as follows
1. First, the WHERE clause is applied as a filter to the data which comes the individual tables.
2. then if there is a JOIN, then the Join are executed in the most optimized way
3. then if there is a GROUP BY clause, the data is grouped based on the grouping column and aggregate functions are applied on the data and if a HAVING clause is there, it is applied to filter the grouped data
4. then SELECT is used to get the desired columns
5. if there is any analytical functions, it will be applied in the output
6. finally, ORDER BY Clause is applied to sort the data
