Using PlanExporter

Before you run the PlanExporter tool, make sure that your classpath contains the Derby jar files, including derbytools.jar/

Before you run the PlanExporter tool, you must capture the stmt_id of the query you have executed from SYSXPLAIN_STATEMENTS system table. To do so, follow these steps:

  1. Use XPLAIN styles to capture the runtime statistics.

    Refer to "SYSCS_UTIL.SYSCS_SET_XPLAIN_SCHEMA system procedure" in the Derby Reference Manual to see how to do this.

    Note: You must remember the schema_name.
  2. Query the SYSXPLAIN_STATEMENTS system table to obtain the stmt_id of the query you have executed.

    Refer to "SYSXPLAIN_STATEMENTS system table" in the Derby Reference Manual for information about the SYSXPLAIN_STATEMENTS system table.

You can run the tool as follows in the directory where your database is located (all on one line).

java org.apache.derby.tools.PlanExporter derby_connection_URL
   schema_name stmt_id options

The options can be passed according to your requirements. Consider the following possible scenarios:

Related reference
PlanExporter XML format
PlanExporter example