Previous | Table of Contents | Next |
If the Oracle Parallel Query option is used and the statement being executed is parallelizable, the following steps take place:
The degree of parallelism is determined by using the following order of precedence:
The processes that execute the query are taken from the set of query servers available in the query server pool. This number is specified by the Oracle initialization parameter PARALLEL_MAX_SERVERS.
If the statement is a query, the final step in the processing of the SQL statement involves fetching the returned data in a loop until all the requested data has been returned to the user process.
Review of SQL Statement Processing
By understanding the process that takes place when an SQL statement is executed, you can see the value in avoiding some of these steps. Taking advantage of SQL statements that have already been parsed is one way to limit the amount of overhead associated with the processing of the statement. |
This chapter begins to look at ways to produce a well-tuned application. The key to having an optimized application is at the heart of the application: the SQL statements themselves. Optimizing your SQL statements and reducing unnecessary overhead will result in an optimized application.
An optimized application together with the tuned and optimized RDBMS server will provide a well-balanced, highly tuned system. Because users are mainly interested in response times, having both a well-tuned application and an optimized server is essential. To get an optimized application, you must start with an optimized SQL statement.
So, what is a well-tuned, optimized SQL statement? Heres a list of some of the characteristics of a well-tuned SQL statement:
These attributes, in conjunction with your own specific attributes, make a well-tuned SQL statement in your configuration. The properly tuned SQL statement avoids unnecessary functions and executes with the minimum amount of resources necessary to perform its function.
During the execution of SQL statements, Oracle chooses a plan by which these statements are executed. The execution plan is determined by the Oracle optimizer by using the optimization approach specified in the initialization parameters. The optimization approach can be overridden by the use of hints.
The effectiveness of the execution plan depends mainly on the optimization method chosen. This optimization method can consist of either a rule-based or cost-based approach. Which approach you take depends on both your application and your data.
To understand how the optimizer optimizes your SQL statements, it is useful to first look at how the optimizer works. When an SQL statement is parsed and passed off to the optimizer, the following occurs:
As you can see, the process through which the optimizer chooses the most optimal execution plan for the SQL statement is quite complex. But it is in this fashion that the best execution plan is usually chosen. At the basic level, the optimizer breaks the statements into their constituent components and determines their individual costs.
Previous | Table of Contents | Next |