4.3. Using Visual Explain

Visual Explain uses menus, icons, and graphical displays to make it easy for you to connect to a database and visualize the query planner output.

Figure 4-1. Visual Explain Main Window

Along the top of the main program window is the Menu Bar. The Menu Bar enables access to SQL and query plan archiving, planner options, preferences and window management dialogs. Below the Menu Bar is the Toolbar. The Toolbar enables you to save, load, and run SQL statements, change the display orientation, and view the nickname of the database to which you are connected.

Below the Toolbar are two panes. On the left is the View Pane, which displays the graphical representation of the query plan. To the right of the View Pane is the Detail Pane, which displays the name of the highlighted node, its characteristics, and performance cost.

Below the View and Detail Panes is the SQL Entry Area, which is where you enter the SQL query you would like explained.

Below the SQL Entry Area is the Status Bar. The Status Bar displays the state of the current database connection.

4.3.1. The Menu Bar

The Menu Bar allows access to SQL and query plan archiving, planner options, preferences, and window management dialogs, among other things.

Figure 4-2. The Menu Bar

The Menu Bar has the following menus:

File

File contains the following items:

  • New clears the SQL Entry Area so that you can type in new SQL commands. You can also save any commands currently in that area.

  • Open presents a dialog where you specify the name of an SQL command (.sql) file or a saved Plan (.pln) file that you want to open. Typically, this is a file that you have created and saved with Visual Explain.

  • Save writes the contents of the SQL Entry Area to the current .sql file name, if you have opened a .sql file, or to a .pln file, if you have opened a saved Plan file. (If there is no current file, you are prompted for a file name and path, as in Save As, below.)

  • Save As writes the contents of the SQL Entry Area to a new .sql file name and path that you specify, if you do not have a plan displayed. If you do have a plan, you can save as a .sql file or as a .pln file by selecting the File Type on the File Chooser dialog.

  • Exit closes Visual Explain.

Edit

Edit contains the following items:

  • Cut removes the selected text from the SQL Entry Area and places it in a clipboard.

  • Copy places the selected text from the SQL Entry Area in a clipboard.

  • Paste places the contents of the clipboard into the SQL Entry Area at the cursor location.

  • Planner Options enables you to change the connection's planner variables so that you can see what other plans the planner would generate.

  • Databases enables you to configure connections to databases.

  • Preferences enables you to configure whether clicking the Explain/Explain Analyze icon invokes EXPLAIN or EXPLAIN ANALYZE, whether Tool Tips appear, and the way icons display, among other things.

Statement

Statement contains launchers that run either EXPLAIN and EXPLAIN ANALYZE on the selected text in the SQL Entry Area. (This text is typically an optimizable SQL command such as SELECT.) You can use this menu item to run whichever function is not invoked by the Toolbar's Explain/Explain Analyze icon. (The function that is invoked by the Toolbar's Explain/Explain Analyze icon is configured with Edit => Preferences => General => Toolbar Button.)

View

View controls the appearance of the display area. You can Zoom In, Zoom Out, or reset the display to its Actual Size. You can also have the display Fit In Window or Fit Width, change its orientation, or Refresh.

Window

In addition to the main window, you can also display overview windows that shows the entire plan tree, the text artifact produced by the backend's EXPLAIN or EXPLAIN ANALYZE commands, and the planner options used when obtaining the plan.

Window controls whether the display area shows the following windows:

Show Plan Overview

Displays an overview of the contents of the Visual Explain View Pane.

Show Planner Options

The value of planner-related variables set to non-default values used to obtain the currently displayed plan.

Show EXPLAIN Output

Displays a text version of the contents of the Visual Explain View Pane.

Show EXPLAIN VERBOSE Output

Displays the verbose text version of the contents of the Visual Explain View Pane.

Help

Help contains information about Visual Explain in the About menu item. It also gives access to the appropriate sections of this manual in HTML.

TipTip
 

Some Menu Bar functions can be activated from the keyboard. Hold [Alt] and press the underlined letter in the menu title (for example, [F] for File).

4.3.2. The Toolbar

The Toolbar enables you to save, load, and run SQL statements, change the orientation of the displayed query output, zoom in or out, and view the nickname of the database to which you are connected.

Figure 4-3. The Toolbar

The Toolbar contains buttons that perform the following actions:

ButtonDescription
New SQL file (clear SQL Entry Area and the current plan).
Open SQL or Plan file.
Save the contents of the SQL Entry Area or the current plan.
Run the SQL command in the SQL Entry Area. This is referred to as the Explain/Explain Analyze icon.
Stop the current query.
Show/Hide the Plan Overview window.
Change the tree orientation of the View Pane.
Zoom in, zoom out, specify zoom factor for the View Pane.
Database to which Visual Explain is connected.

Table 4-1. Visual Explain Toolbar Buttons

4.3.3. The View Pane and Detail Pane

The View Pane (left pane) displays the graphical representation of the query plan for the execution of your SQL query. The Detail Pane (right pane) is a table that displays the name of the highlighted plan node, its characteristics, and performance cost.

Figure 4-4. The View Pane and Detail Pane

You can move the visible portion of the View Pane by using the scroll bars or by putting the focus in the View Pane, holding down [Shift], and pressing the arrow keys.

The View Pane can contain the following node icons:

NodeDescriptionIcon
AggregateProduce one value from multiple input rows.
AppendCombine rows from multiple input nodes.
GroupCombine input rows into groups.
HashSelect rows using a hash.
InitplanProcess an un-related sub-query.
JoinCombine rows from two input nodes.
LimitSelect a certain number of rows.
MaterializeCreate a temporary table.
ResultGenerate a row or rows from an expression (with no table reference), or check a constant qualification.
ScanScan a relation for certain rows.
SetOpPerform a set operation.
SortPlace input rows in some order.
SubPlanProcess a sub-query.
UniqueDiscard all duplicate rows.

Table 4-2. Visual Explain Icons

4.3.4. The SQL Entry Area

The SQL Entry Area is where you type your SQL queries. Use the menus or the Toolbar buttons to execute or save them.

Figure 4-5. The SQL Entry Area

4.3.5. The Status Bar

The Status Bar displays the state of the current database connection, if any exists.

Figure 4-6. The Status Bar