An excellent way to understand the functionality of a tool is through a tutorial. The following section is a tutorial on how to use Visual Explain.
It is assumed that during the installation of PostgreSQL - Red Hat Edition, the post-installer was run. This created the postgres userid and created a database cluster in /var/lib/pgsql/data. It is also assumed that Visual Explain was started by the superuser postgres.
Visual Explain uses JDBC to communicate with the PostgreSQL server and requires the use of TCP/IP. The following tutorial assumes that TCP/IP has been enabled and that the trust host-based authentication will allow connections from all locations. If you are unsure as to how to modify your PostgreSQL installation, refer to Section 6.4.3 Modifying Database Cluster Configuration Files for details on how to modify these values.
Topics covered in this tutorial are:
Configuring a Connection
Connecting to a Database
Entering a Query
After you start Visual Explain (as described in Section 4.2 Starting Visual Explain), the next task is to configure a connenction to a database.
To add a database to the tool, from the Menu Bar choose Edit => Databases.
The Edit Database Connections dialog appears.
In the Edit Database Connections dialog, select New, which brings up the New Database dialog. Note that this does not create a new database, just a new connection configuration for an existing database. The Nickname entered in this dialog will be displayed on the Toolbar. The example uses a nickname of tutorial, connects to the local host's regression database on port 5432, and uses userid postgres.
Select OK to add this configuration to the list of possible database choices in the Edit Database Connections dialog.
Select OK to close the Edit Database Connections dialog.
After configuring a connection, the next task is to connect Visual Explain to the configured database.
On the top at the far right of the Toolbar, the Database combo-box contains a list of configured databases.
Select tutorial and you will be connected to the regression database on the local host. Notice the Status Bar has been updated with the connection information.
Now that you are connected to the regression database, you are able to submit queries through Visual Explain. In the SQL Entry Area type:
select * from b_star; |
and select the Explain/Explain Analyze icon
on the Toolbar.
The resultant EXPLAIN
tree is now displayed graphically in the View Pane.
Notice that selecting different nodes in the resultant tree causes the Detail Pane to update with information specific to the highlighted node.