Before you run the PlanExporter tool, make sure that
your classpath contains the
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:
- Use XPLAIN styles to capture the runtime statistics.
Refer to "SYSCS_UTIL.SYSCS_SET_XPLAIN_SCHEMA system procedure" in the
to see how to do this.
You must remember the schema_name.
- 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
for information
about the SYSXPLAIN_STATEMENTS system table.
You can run the tool as follows in the directory where your database
is located.
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:
-
To generate an XML file of the query plan, specify the following option:
-xml path
The path can be either absolute or relative. If the root filename does
not have a suffix, the tool appends .xml.
-
To generate a plain HTML file of the query plan, you can use the default
simple style sheet provided with
. Specify the following
options:
-html path
If the root filename does not have a suffix, the tool appends
.html.
To generate the XML file as well, specify the following options:
-xml path -html path
To use a different style sheet that does not contain any javascript
functions, specify the following options:
-xsl path -html path
To generate the XML file as well, specify the following options:
-xml path -xsl path -html path
-
To generate an advanced view of the query plan, you can use advanced XSL
style sheets provided with
inside derbytools.jar/org/apache/derby/impl/tools/planexporter/resources/, or you can specify a
style sheet created by you. To do this, specify the following options:
-adv -xsl fileName -xml path
- Before you use the -adv feature, you must copy the advanced
XSL style sheet into the current directory. Thus, you must specify only
the name of the style sheet, not the path.
- Generating HTML is not supported when you use the -adv
feature of the PlanExporter tool. But if you open
the generated XML file in a web browser, the browser will do the
necessary transformation.