db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpendle...@apache.org
Subject svn commit: r982865 - in /db/derby/docs/trunk/src/tools: ctoolsplanexp.dita ctoolsusingplanexp.dita derbytools.ditamap rtoolsplanexpexamples.dita
Date Fri, 06 Aug 2010 03:55:45 GMT
Author: bpendleton
Date: Fri Aug  6 03:55:45 2010
New Revision: 982865

URL: http://svn.apache.org/viewvc?rev=982865&view=rev
Log:
DERBY-4758: Add documentation for PlanExporter tool

This patch was contributed by C.S. Nirmal J. Fernando (nirmal070125 at gmail dot com)

This patch adds documentation for the PlanExporter tool to the Derby Tools
and Utilities guide. The initial version of the documentation describes
the purpose of the tools, the syntax for invoking the tool, and some examples
of how to run the tool to achieve a variety of output formats.


Added:
    db/derby/docs/trunk/src/tools/ctoolsplanexp.dita
    db/derby/docs/trunk/src/tools/ctoolsusingplanexp.dita
    db/derby/docs/trunk/src/tools/rtoolsplanexpexamples.dita
Modified:
    db/derby/docs/trunk/src/tools/derbytools.ditamap

Added: db/derby/docs/trunk/src/tools/ctoolsplanexp.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/tools/ctoolsplanexp.dita?rev=982865&view=auto
==============================================================================
--- db/derby/docs/trunk/src/tools/ctoolsplanexp.dita (added)
+++ db/derby/docs/trunk/src/tools/ctoolsplanexp.dita Fri Aug  6 03:55:45 2010
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at      
+
+http://www.apache.org/licenses/LICENSE-2.0  
+
+Unless required by applicable law or agreed to in writing, software  
+distributed under the License is distributed on an "AS IS" BASIS,  
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
+See the License for the specific language governing permissions and  
+limitations under the License.
+-->
+<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "../dtd/concept.dtd">
+<concept xml:lang="en-us" id="ctoolsplanexp">
+<title>PlanExporter Tool</title>
+<prolog><metadata>
+<keywords><indexterm>PlanExporter</indexterm></keywords>
+</metadata>
+</prolog>
+<conbody>
+<p>Use the <codeph>PlanExporter</codeph> tool to export query plan data
for
+further analysis. The query plan data can be exported in a variety of formats.
+The base format for exported query plan data is XML. Query plan data can also
+be exported in HTML format, which helps you view graphically 
+the execution plans of complex queries you have executed. By using this tool
+you can avoid querying <codeph>XPLAIN style tables</codeph> to get a 
+basic idea of the query plan followed by the <codeph>Optimizer</codeph>.
+You can specify other query plan export formats by specifying an appropriate
+XSL stylesheet to transform the query plan data, or you can export the
+query plan data as XML, then reformat as appropriate using any external
+XML-aware tool of your choice.
+</p>
+</conbody>
+</concept>

Added: db/derby/docs/trunk/src/tools/ctoolsusingplanexp.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/tools/ctoolsusingplanexp.dita?rev=982865&view=auto
==============================================================================
--- db/derby/docs/trunk/src/tools/ctoolsusingplanexp.dita (added)
+++ db/derby/docs/trunk/src/tools/ctoolsusingplanexp.dita Fri Aug  6 03:55:45 2010
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN"
+ "../dtd/concept.dtd">
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at      
+
+http://www.apache.org/licenses/LICENSE-2.0  
+
+Unless required by applicable law or agreed to in writing, software  
+distributed under the License is distributed on an "AS IS" BASIS,  
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
+See the License for the specific language governing permissions and  
+limitations under the License.
+-->
+<concept id="ctoolsusingplanexp" xml:lang="en-us">
+<title>Using PlanExporter</title>
+<prolog><metadata>
+<keywords><indexterm>PlanExporter<indexterm>using</indexterm></indexterm>
+</keywords>
+</metadata></prolog>
+<conbody>
+<p>Before you run the <codeph>PlanExporter</codeph> tool, make sure that
+your classpath contains the
+<ph conref="../conrefs.dita#prod/productshortname"></ph> jar files, including
+<i>derbytools.jar</i>.</p>
+<p>Other than that you need <i>xalan.jar</i> in your classpath as well.</p>
+<p>Before you run the <codeph>PlanExporter</codeph> tool, you must capture
the 
+<codeph>STMT_ID</codeph> of the query you have executed from
+<codeph>SYSXPLAIN_STATEMENTS system table</codeph>. You can do it like
+this: </p>
+<ul>
+<li><b>Use XPLAIN styles to capture the runtime statistics:</b> 
+<p>Refer to the "SYSCS_UTIL.SYSCS_SET_XPLAIN_SCHEMA system procedure" in 
+<ph conref="../conrefs.dita#pub/citref"></ph> to see how to do this.</p>
+<note> You have to remember the <codeph>SCHEMA_NAME</codeph>.</note>
</li>
+<li><b>Query <codeph>SYSXPLAIN_STATEMENTS system table</codeph>
+to grab the <codeph>STMT_ID</codeph> of the query you have executed.</b>

+<note> Refer to "SYSXPLAIN_STATEMENTS system table" in 
+<ph conref="../conrefs.dita#pub/citref"></ph> for information 
+about <codeph>SYSXPLAIN_STATEMENTS system table</codeph>.</note>
+</li>
+</ul>
+<p>You can run the tool as follows inside the directory where your database
+is located.</p>
+<codeblock>
+	java org.apache.derby.tools.PlanExporter jdbc:derby:<i>database_name 
+		username password SCHEMA_NAME STMT_ID</i> [<i>arguments</i>]
+</codeblock>
+<p>[<i>arguments</i>] can be passed according to your requirement. Consider

+following possible scenarios:</p>
+<p>If your requirement is,</p>
+<ul>
+<li>
+<b>only to generate a XML file of the query plan:</b>
+<p>You can pass 
+<codeblock>	-xml {path}</codeblock> argument.</p>
+</li>
+<li>
+<b>to generate a plain HTML file of the query plan:</b>
+<p>Simply you can use the default simple style sheet provided with
+<ph conref="../conrefs.dita#prod/productshortname"></ph> if you
+use following arguments: </p>
+<ul>
+<li>You can pass 
+<codeblock>	-html {path}</codeblock> argument.</li>
+<li>You can pass 
+<codeblock>	-xml {path} -html {path}</codeblock> 
+arguments, if you want to generate the XML file as well.</li>
+</ul>
+<p>If you have a different style sheet, which does not contain any 
+<i>javascript</i> functions, you can use following arguments: </p>
+<ul>
+<li>You can pass 
+<codeblock>	-xsl {path} -html {path}</codeblock> 
+arguments. </li>
+<li>You can pass 
+<codeblock>	-xml {path} -xsl {path} -html {path}</codeblock> arguments, 
+if you want to generate the XML file as well.</li>
+</ul>
+</li>
+<li>
+<b>to generate an advanced view of the query plan:</b>
+<p>You can use advanced XSL style sheets provided with 
+<ph conref="../conrefs.dita#prod/productshortname"></ph> or
+you can specify a style sheet created by you, if you use 
+following argument:</p>
+<ul>
+<li>You can pass 
+<codeblock>	-adv -xsl {file_name} -xml {path}</codeblock> 
+arguments.
+<note> 
+<ul>
+<li>When you use <codeph>-adv</codeph> feature, you must copy the advanced
+XSL style sheet into the current directory. Thus, you must only specify
+the name of the style sheet.</li>
+<li>Generating a HTML is not supported when you use <codeph>-adv</codeph>
+feature of the <codeph>PlanExporter</codeph> tool. But you can always open
+the generated XML file, in your web browser, then your browser will do the
+necessary transformation.</li>
+</ul>
+</note>
+</li>
+</ul>
+</li>
+</ul>
+</conbody>
+</concept>

Modified: db/derby/docs/trunk/src/tools/derbytools.ditamap
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/tools/derbytools.ditamap?rev=982865&r1=982864&r2=982865&view=diff
==============================================================================
--- db/derby/docs/trunk/src/tools/derbytools.ditamap (original)
+++ db/derby/docs/trunk/src/tools/derbytools.ditamap Fri Aug  6 03:55:45 2010
@@ -349,5 +349,9 @@ limitations under the License.
 <topicref collection-type="family" href="ctoolssigcheck.dita" navtitle="SignatureChecker">
 <topicref href="ctoolsusingsigcheck.dita" navtitle="Using SignatureChecker"></topicref>
 </topicref>
+<topicref collection-type="family" href="ctoolsplanexp.dita" navtitle="PlanExporter Tool">
+<topicref href="ctoolsusingplanexp.dita" navtitle="Using PlanExporter"></topicref>
+<topicref href="rtoolsplanexpexamples.dita" navtitle="PlanExporter Examples"></topicref>
+</topicref>
 <topicref href="rtoolstrademderby.dita" navtitle="Trademarks"></topicref>
 </map>

Added: db/derby/docs/trunk/src/tools/rtoolsplanexpexamples.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/tools/rtoolsplanexpexamples.dita?rev=982865&view=auto
==============================================================================
--- db/derby/docs/trunk/src/tools/rtoolsplanexpexamples.dita (added)
+++ db/derby/docs/trunk/src/tools/rtoolsplanexpexamples.dita Fri Aug  6 03:55:45 2010
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+ 
+<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN"
+ "../dtd/reference.dtd">
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at      
+
+http://www.apache.org/licenses/LICENSE-2.0  
+
+Unless required by applicable law or agreed to in writing, software  
+distributed under the License is distributed on an "AS IS" BASIS,  
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
+See the License for the specific language governing permissions and  
+limitations under the License.
+-->
+<reference id="rtoolsplanexpexamples" xml:lang="en-us">
+<title>PlanExporter Examples</title>
+<prolog><metadata>
+<keywords><indexterm>PlanExporter<indexterm>Examples</indexterm></indexterm>
+<indexterm>Examples<indexterm>PlanExporter</indexterm></indexterm>
+</keywords>
+</metadata></prolog>
+<refbody>
+<section><p>The following example demonstrates a complete procedure
+that you must follow in order to use <codeph>PlanExporter</codeph> tool.</p>
+</section>
+<example>
+<ul>
+<li>Move to the directory where your database has created. </li>
+<li>Run <codeph>ij</codeph> tool:
+<codeblock>	java org.apache.derby.tools.ij</codeblock>
+</li>
+<li>Create a connection to the database:
+<codeblock>	CONNECT 'jdbc:derby:myDb;create=false';</codeblock>
+<note>You can use <ph conref="../conrefs.dita#prod/productshortname"></ph>
+client/server database as well. </note>
+</li>
+<li>Use XPLAIN styles:
+<codeblock>
+	CALL SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1);
+	CALL SYSCS_UTIL.SYSCS_SET_XPLAIN_SCHEMA('MY_SCHEMA');
+	select * from my_table;
+	CALL SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(0);
+	CALL SYSCS_UTIL.SYSCS_SET_XPLAIN_SCHEMA('');
+</codeblock>
+</li>
+<li>Grab the <codeph>stmt_id</codeph> of the query:
+<codeblock>
+	select stmt_text, stmt_id from MY_SCHEMA.SYSXPLAIN_STATEMENTS;
+	exit;
+</codeblock>
+<p>Now find the stmt_id of the executed query, from the displaying
+results, and note it down. My case it is 
+<codeph>9ac8804c-0129-cc31-ca9a-00000047f1e8</codeph>.</p>
+</li>
+<li>Run the <codeph>PlanExporter</codeph> tool in the same location:
+<codeblock>
+	java org.apache.derby.tools.PlanExporter jdbc:derby:myDb "" "" MY_SCHEMA 
+		9ac8804c-0129-cc31-ca9a-00000047f1e8 -html plain_html;
+</codeblock>
+<note>Here I have used the default style sheet provided with 
+<ph conref="../conrefs.dita#prod/productshortname"></ph>, and the HTML
+file will be generated at the same location, since I have not specified 
+a different path. The name of the HTML file generated is <i>plain_html.html</i>
+</note>
+</li>
+</ul>
+</example>
+</refbody>
+</reference>



Mime
View raw message