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

125 lines
7.9 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?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="Temporary index scan" />
<meta name="abstract" content="A temporary index scan operation is identical to the index scan operation that is performed upon the permanent radix index. It is still used to retrieve the rows from a table in a keyed sequence; however, the temporary index object must first be created. All of the rows in the index will be sequentially processed, but the resulting row numbers will be sequenced based upon the key columns." />
<meta name="description" content="A temporary index scan operation is identical to the index scan operation that is performed upon the permanent radix index. It is still used to retrieve the rows from a table in a keyed sequence; however, the temporary index object must first be created. All of the rows in the index will be sequentially processed, but the resulting row numbers will be sequenced based upon the key columns." />
<meta name="DC.subject" content="definitions, temporary index scan access method, temporary index, scan access method, index, temporary, access method, temporary index scan" />
<meta name="keywords" content="definitions, temporary index scan access method, temporary index, scan access method, index, temporary, access method, temporary index scan" />
<meta name="DC.Relation" scheme="URI" content="rzajqtempindex.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="rzajqtempinscan" />
<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>Temporary index scan</title>
</head>
<body id="rzajqtempinscan"><a name="rzajqtempinscan"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Temporary index scan</h1>
<div><p>A temporary index scan operation is identical to the index scan
operation that is performed upon the permanent radix index. It is still used
to retrieve the rows from a table in a keyed sequence; however, the temporary
index object must first be created. All of the rows in the index will be sequentially
processed, but the resulting row numbers will be sequenced based upon the
key columns.</p>
<div class="section"><p>The sequenced rows can be used by the optimizer to satisfy a portion
of the query request (such as ordering or grouping).</p>
</div>
<div class="section">
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><caption>Table 1. Temporary index scan attributes</caption><thead align="left"><tr><th valign="top" width="31.979695431472084%" id="d0e43">Data access method</th>
<th valign="top" width="68.02030456852792%" id="d0e45">Temporary index scan</th>
</tr>
</thead>
<tbody><tr><td valign="top" width="31.979695431472084%" headers="d0e43 "><strong>Description</strong></td>
<td valign="top" width="68.02030456852792%" headers="d0e45 ">Sequentially scan and process all of the keys associated
with the temporary index. </td>
</tr>
<tr><td valign="top" width="31.979695431472084%" headers="d0e43 "><strong>Advantages</strong></td>
<td valign="top" width="68.02030456852792%" headers="d0e45 "><ul><li>Potential to extract all of the data from the index keys' values, thus
eliminating the need for a Table Probe</li>
<li>Returns the rows back in a sequence based upon the keys of the index</li>
</ul>
</td>
</tr>
<tr><td valign="top" width="31.979695431472084%" headers="d0e43 "><strong>Considerations</strong></td>
<td valign="top" width="68.02030456852792%" headers="d0e45 ">Generally requires a Table Probe to be performed to
extract any remaining columns required to satisfy the query. Can perform poorly
when a large number of rows are selected because of the random I/O associated
with the Table Probe. </td>
</tr>
<tr><td valign="top" width="31.979695431472084%" headers="d0e43 "><strong>Likely to be used</strong></td>
<td valign="top" width="68.02030456852792%" headers="d0e45 "><ul><li>When sequencing the rows is required for the query (for example, ordering
or grouping) </li>
<li>When the selection columns cannot be matched against the leading key columns
of the index</li>
<li>When the overhead cost associated with the creation of the temporary index
can be justified against other alternative methods to implement this query</li>
</ul>
</td>
</tr>
<tr><td valign="top" width="31.979695431472084%" headers="d0e43 "><strong>Example SQL statement</strong></td>
<td valign="top" width="68.02030456852792%" headers="d0e45 "><pre>SELECT * FROM Employee
WHERE WorkDept BETWEEN 'A01' AND 'E01'
ORDER BY LastName
OPTIMIZE FOR ALL ROWS</pre>
</td>
</tr>
<tr><td valign="top" width="31.979695431472084%" headers="d0e43 "><strong>Messages indicating use</strong></td>
<td valign="top" width="68.02030456852792%" headers="d0e45 "><ul><li>Optimizer Debug: <pre>CPI4321 -- Access path built for file EMPLOYEE.</pre>
</li>
<li>PRTSQLINF: <pre>SQL4009 -- Index created for table 1.</pre>
</li>
</ul>
</td>
</tr>
<tr><td valign="top" width="31.979695431472084%" headers="d0e43 "><strong>SMP parallel enabled</strong></td>
<td valign="top" width="68.02030456852792%" headers="d0e45 ">Yes</td>
</tr>
<tr><td valign="top" width="31.979695431472084%" headers="d0e43 "><strong>Also referred to as</strong></td>
<td valign="top" width="68.02030456852792%" headers="d0e45 ">Index Scan <p>Index Scan, Preload</p>
<p>Index Scan,
Distinct</p>
<p>Index Scan Distinct, Preload</p>
<p>Index Scan, Key Selection</p>
</td>
</tr>
<tr><td valign="top" width="31.979695431472084%" headers="d0e43 "><strong>Visual Explain icon</strong></td>
<td valign="top" width="68.02030456852792%" headers="d0e45 "><br /><img src="rzajq530.gif" alt="Temporary radix index scan" /><br /></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section"><p>Using the example above, the optimizer chose to create a temporary
index to sequence the rows based upon the LastName column. A temporary index
scan might then be performed to satisfy the ORDER BY clause in this query.</p>
</div>
<div class="section"><p>The optimizer will determine where the selection against the WorkDept
column best belongs. It can be performed as the temporary index itself is
being created or it can be performed as a part of the temporary index scan.
Adding the selection to the temporary index creation has the possibility of
making the open data path (ODP) for this query non-reusable. This ODP reuse
is taken into consideration when determining how selection will be performed. </p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajqtempindex.htm" title="A temporary index is a temporary object that allows the optimizer to create and use a radix index for a specific query. The temporary index has all of the same attributes and benefits as a radix index that is created by a user through the CREATE INDEX SQL statement or Create Logical File (CRTLF) CL command.">Temporary index</a></div>
</div>
</div>
</body>
</html>