The different means of capturing explain information include using:
There are three reasons you may wish to collect and use explain data:
After making a change in any of these areas, you can use the SQL explain facility to determine the impact, if any, that the change has on the access plan chosen. For example, if you add an index based on the recommendations provided in Indexing Impact on Query Optimization, the explain data can help you determine whether the index is, in fact, being used as you expected.
While the explain output will provide you with information to allow you to determine the access plan that was chosen and its relative cost, the only way to accurately measure the performance improvement for a query is to use benchmark testing techniques, as described in Chapter 31, Benchmark Testing.
The above information provides you with a before picture that you can use as a reference point for future analysis. For dynamic SQL statements, you can also collect this information when you run your application for the first time. For static SQL statements, you can also collect this information at bind time.
When you wish to analyze the reason for a performance change, you can compare the before data to information you collect about the query and environment when you are starting your analysis (the after data).
As a simple example, your analysis could show that an index is no longer being used as part of the access path. Using the catalog statistics information in Visual Explain, you might notice that the number of index levels (NLEVELS column) is now substantially higher than when the query was first bound to the database. You might then choose to:
Following these actions, you might notice that the index is once again being used in the access plan and that performance of the query is no longer a problem.