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 GemFire XD cluster. For example:
    gfxd> 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:
    gfxd> call SYSCS_UTIL.SET_EXPLAIN_CONNECTION(1);
  3. Use the SYSCS_UTIL.SET_STATISTICS_TIMING procedure to also capture query statistics information at a specified interval. For example:
    gfxd> 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:
    gfxd> call SYSCS_UTIL.SET_EXPLAIN_CONNECTION(0);
    gfxd> 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.