O'Reilly logo

Java Programming with Oracle SQLJ by Jason Price

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

10.4. The Oracle Optimizer

The Oracle Relational Database Management System (RDBMS) uses a subsystem known as the optimizer to generate the most efficient path to access the data stored in the tables. This path is known as the execution plan. Examining the execution plans generated by the optimizer allows you to judge the relative cost of one SQL statement versus another. You can then compare the costs of your SQL statements and use the results to adjust your statements accordingly. You can also affect the execution plan for a statement by passing hints to the optimizer. A hint is an optimizer directive that you may supply to help the optimizer generate a more efficient plan based on your needs. Before using hints in a given query, you should perform the three simple tuning activities described in the previous sections. Then, if you need further performance improvements, you should examine the execution plan for your query and consider the use of hints. In this section, I describe the different types of optimization methods used by the optimizer. Then I show you how to view and interpret a couple of example execution plans, and finally, I discuss the use of optimizer hints.

10.4.1. Understanding Optimization Methods

The optimizer may use one of two possible methods to generate the execution plan for a query. The first method is known as rule-based optimization, because syntactic rules are used to generate the execution plan. The second method is known as cost-based optimization, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required