ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzajq_5.4.0.1/psi.htm

77 lines
5.3 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="Gather information about embedded SQL statements with the PRTSQLINF command" />
<meta name="abstract" content="The Print SQL Information (PRTSQLINF) command returns information about the embedded SQL statements in a program, SQL package (the object normally used to store the access plan for a remote query), or service program. This information is then stored in a spooled file." />
<meta name="description" content="The Print SQL Information (PRTSQLINF) command returns information about the embedded SQL statements in a program, SQL package (the object normally used to store the access plan for a remote query), or service program. This information is then stored in a spooled file." />
<meta name="DC.subject" content="message, PRTSQLINF, viewing with iSeries Navigator" />
<meta name="keywords" content="message, PRTSQLINF, viewing with iSeries Navigator" />
<meta name="DC.Relation" scheme="URI" content="queryopt.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/prtsqlinf.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="psi" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Gather information about embedded SQL statements with the PRTSQLINF command</title>
</head>
<body id="psi"><a name="psi"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Gather information about embedded SQL statements with the <span class="cmdname">PRTSQLINF</span> command</h1>
<div><p>The <span class="cmdname">Print SQL Information (PRTSQLINF)</span> command
returns information about the embedded SQL statements in a program, SQL package
(the object normally used to store the access plan for a remote query), or
service program. This information is then stored in a spooled file.</p>
<div class="section"><p><span class="cmdname">PRTSQLINF</span> provides information about: </p>
<ul><li>The SQL statements being executed</li>
<li>The type of access plan used during execution. This includes information
about how the query will be implemented, the indexes used, the join order,
whether a sort is done, whether a database scan is sued, and whether an index
is created.</li>
<li>A list of the command parameters used to precompile the source member
for the object.</li>
<li>The CREATE PROCEDURE and CREATE FUNCTION statement text used to create
external procedures or User Defined Functions.</li>
</ul>
<p>This output is similar to the information that you can get from debug
messages. However, while query debug messages work at runtime, <span class="cmdname">PRTSQLINF</span> works
retroactively. You can also see this information in the second level text
of the query governor inquiry message CPA4259.</p>
</div>
<div class="section"><p>You can issue <span class="cmdname">PRTSQLINF</span> in a couple of ways.
First, you can run the <span class="cmdname">PRTSQLINF</span> command against a saved
access plan. This means you must execute or at least prepare the query (using
SQL's PREPARE statement) before you use the command. It is best to execute
the query because the index created as a result of PREPARE is relatively sparse
and may well change after the first run. <span class="cmdname">PRTSQLINF</span>'s requirement
of a saved access plan means the command cannot be used with <span class="cmdname">OPNQRYF</span>.</p>
</div>
<div class="section"><p>You can also run <span class="cmdname">PRTSQLINF</span> against functions,
stored procedures, triggers, SQL packages, and programs from iSeries™ Navigator.
This function is called Explain SQL. To view <span class="cmdname">PRTSQLINF</span> information,
right-click an object and select <span class="uicontrol">Explain SQL</span>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="queryopt.htm" title="Query optimization is an iterative process. You can gather performance information about your queries and control the processing of your queries.">Optimizing query performance using query optimization tools</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../cl/prtsqlinf.htm">Print SQL Information (PRTSQLINF) command</a></div>
</div>
</div>
</body>
</html>