1.1.1

Table Of Contents
See Query Plan Codes on page 276 for information about individual codes displayed in the query plan output.
Capture Query Plans for All Statements
As an alternative to using the EXPLAIN command, you can use built-in system procedures to enable and disable
query execution plan and statistics capture for all statements that you execute on a connection.
Procedure
1. Establish a peer client or thin client connection to the SQLFire cluster. For example:
sqlf
connect peer 'host-data=false;mcast-port=12777';
2. Use the SYSCS_UTIL.SET_EXPLAIN_CONNECTION procedure to begin capturing query execution plans
for queries on this connection:
call SYSCS_UTIL.SET_EXPLAIN_CONNECTION(1);
3. Use the SYSCS_UTIL.SET_STATISTICS_TIMING procedure to also capture query statistics information
at a specied interval. For example:
call SYSCS_UTIL.SET_STATISTICS_TIMING(1);
4. Execute the queries of interest and step through the result set of each query.
5. To disable query plan capture:
call SYSCS_UTIL.SET_EXPLAIN_CONNECTION(0);
call SYSCS_UTIL.SET_STATISTICS_TIMING(0);
After you have captured query execution plans, you can use a peer client connection to query the captured plans.
Example Query Plan Analysis
This example uses the installed ToursDB database to explain how to analyze basic query plans in SQLFire.
To follow along with this example, you must have access to a vFabric SQLFire installation and the ToursDB
scripts in the quickstart subdirectory.
1.
Set your PATH environment variable to include the bin subdirectory of the SQLFire installation.
2. Start a single SQLFire server. For example:
mkdir query-plan-example
cd query-plan-example
sqlf server start
3.
Change to the quickstart subdirectory of your SQLFire installation:
cd ~/vFabric_SQLFire_11_bNNNNN/quickstart
4. Connect to the server as a peer, and execute the scripts to create the sample database:
sqlf
connect peer 'host-data=false;mcast-port=10334';
run 'ToursDB_schema.sql';
run 'loadTables.sql';
5.
Increase the sqlf maximum display width in order to show the full query plan output:
maximumdisplaywidth 10000;
vFabric SQLFire User's Guide272
Managing and Monitoring vFabric SQLFire