1.1.1

Table Of Contents
Chapter 45
Evaluating Query Plans and Query
Statistics
SQLFire can capture query execution plans to determine whether a given query will execute locally, or will execute
in parallel across members of the cluster.
You can also use query execution plans to determine where the system spends time in executing a particular query.
You can generate Query plans on any peer or thin client connection that enables query plans.
Capture a Query Plan for an Individual Statement
SQLFire provides the EXPLAIN command to display the query execution plan for a single statement.
Procedure
1. Establish a peer client connection to the SQLFire cluster. For example:
sqlf
connect peer 'host-data=false;mcast-port=12777';
2.
Increase the sqlf maximum display width in order to show the full query plan output. For example:
sqlf> maximumdisplaywidth 10000;
3. Use the EXPLAIN command with a SQL statement to capture the query execution plan for that statement.
For example:
explain select * from flights f, flightavailability fa where f.flight_id
= fa.flight_id;
Note: If you did not increase the default MAXIMUMDISPLAYWIDTH value, the EXPLAIN play output is truncated before any query plan codes appear. If this occurs, re-run the EXPLAIN command, specifying the statement ID (the STMT_ID value
stored in SYS.STATEMENTPLANS) of the plan you just created. For example:
sqlf> select STMT_ID, STMT_TEXT from SYS.STATEMENTPLANS;
STMT_ID |STMT_TEXT
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
00000001-ffff-ffff-ffff-000000000022| select * from flights f, flightavailability fa where f.flight_id = fa.flight_id and f.flight_id = 'AA1116'
1 row selected
sqlf> explain '00000001-ffff-ffff-ffff-000000000022';
You must connect using a peer client connection to view captured query plans.
See Example Query Plan Analysis on page 272 for an example that describes the query plan output.
271