There are two ways to invoke the Visual Explain tool. The first,
and most common, is through iSeries™ Navigator. The second is through the Visual
Explain (QQQVEXPL) API.
You can start Visual Explain from any of the following windows
in iSeries Navigator:
- Enter an SQL statement in the Run SQL Scripts window.
Select the statement and choose Explain from the context
menu, or select Run and Explain from the Visual
Explain menu.
- Expand the list of available SQL Performance Monitors. Right-click a detailed
SQL Performance Monitor and choose the Show Statements option.
Select filtering information and select the statement in the List of Statements
window. Click Run Visual Explain. You can also start
an SQL Performance Monitor from Run SQL Scripts. Select Start SQL
Performance monitor from the Monitor menu.
- Start the Current SQL for a Job function by right-clicking Databases and
select Current SQL for a Job. Select a job from the
list and click SQL Statement. When the SQL is displayed
in the lower pane, you can start Visual Explain by clicking Run
Visual Explain.
- Right-click SQL Plan Cache and select Show Statements.
Select filtering information and select the statement in the List of Statements
window. Click Run Visual Explain.
- Expand the list of available SQL Plan Cache Snapshots. Right-click a snapshot
and select Show Statements. Select filtering information
and select the statement in the List of Statements window. Click Run
Visual Explain.
You have three options when running Visual Explain
from Run SQL Scripts.
- Visual Explain only
- This option allows you to explain the query without actually running it.
The data displayed represents the query optimizer's estimates.
Note: When using
the Explain only option of Visual Explain from Run SQL Scripts in iSeries Navigator,
some queries receive an error code 93 stating that they are too complex for
displaying in Visual Explain. You can circumvent this by selecting the "Run
and Explain" option.
- Run and Explain
- If you select Run and Explain, the query is run by the system before the
diagram is displayed. This option may take a significant amount of time, but
the information displays is more complete and accurate.
- Explain while running
- For long running queries, you can choose to start Visual Explain while
the query is running. By refreshing the Visual Explain diagram, you can view
the progress of the query.
In addition, a database monitor table that was not created
as a result of using iSeries Navigator can be explained through iSeries Navigator.
First you must import the database monitor table into iSeries Navigator. To do this, right-click
the SQL Performance Monitors and choose the Import option.
Specify a name for the performance monitor (name it will be known by within iSeries Navigator)
and the qualified name of the database monitor table. Be sure to select Detailed
as the type of monitor. Detailed represents the file-based (STRDBMON) monitor
while Summary represents the memory-resident monitor (which is not supported
by Visual Explain). Once the monitor has been imported, follow the steps to
start Visual Explain from within iSeries Navigator.
You can save your Visual Explain information as an SQL Performance
monitor, which can be useful if you started the query from Run SQL Scripts
and want to save the information for later comparison. Select Save
as Performance monitor from the File menu.