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

120 lines
7.2 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="Sorted list scan" />
<meta name="abstract" content="During a sorted list scan operation, the entire temporary sorted list is scanned and all of the entries contained within the sorted list will be processed." />
<meta name="description" content="During a sorted list scan operation, the entire temporary sorted list is scanned and all of the entries contained within the sorted list will be processed." />
<meta name="DC.subject" content="definitions, sorted list scan access method, temporary sorted list, scan access method, sorted list scan, access method" />
<meta name="keywords" content="definitions, sorted list scan access method, temporary sorted list, scan access method, sorted list scan, access method" />
<meta name="DC.Relation" scheme="URI" content="rzajqtempslist.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="rzajqslistscan" />
<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>Sorted list scan</title>
</head>
<body id="rzajqslistscan"><a name="rzajqslistscan"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Sorted list scan</h1>
<div><p>During a sorted list scan operation, the entire temporary sorted
list is scanned and all of the entries contained within the sorted list will
be processed. </p>
<div class="section"><p>A sorted list scan is generally considered when the optimizer
is considering a plan that requires the data values to be sequenced. The use
of a sorted list scan will allow the optimizer to generate a plan that can
take advantage of any non-join selection while creating the temporary sorted
list. An additional benefit of using a sorted list scan is that the data structure
of the temporary sorted list will usually cause the table data within the
sorted list to remain resident within main memory after creation thus reducing
paging on the subsequent sorted list scan operation.</p>
</div>
<div class="section">
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><caption>Table 1. Sorted list scan attributes</caption><thead align="left"><tr><th valign="top" width="31.313131313131315%" id="d0e41">Data access method</th>
<th valign="top" width="68.68686868686868%" id="d0e43">Sorted list scan</th>
</tr>
</thead>
<tbody><tr><td valign="top" width="31.313131313131315%" headers="d0e41 "><strong>Description</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e43 ">Read all of the entries in a temporary sorted list.
The sorted list may perform distinct processing to eliminate duplicate values
or take advantage of the temporary sorted list to sequence all of the rows.</td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e41 "><strong>Advantages</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e43 "><ul><li>Reduces the random I/O to the table generally associated with longer running
queries that would otherwise use an index to sequence the data.</li>
<li>Selection can be performed prior to generating the sorted list to subset
the number of rows in the temporary object</li>
</ul>
</td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e41 "><strong>Considerations</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e43 ">Generally used to process ordering or distinct processing.
Can perform poorly when the entire sorted list does not stay resident in memory
as it is being populated and processed. </td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e41 "><strong>Likely to be used</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e43 "><ul><li>When the use of temporary results is allowed by the query environmental
parameter (ALWCPYDTA)</li>
<li>When the data is required to be ordered based upon a column or columns
for ordering or distinct processing</li>
</ul>
</td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e41 "><strong>Example SQL statement</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e43 "> <pre>CREATE INDEX X1 ON Employee (LastName, WorkDept)
SELECT * FROM Employee
WHERE WorkDept BETWEEN 'A01' AND 'E01'
ORDER BY FirstNme
OPTIMZE FOR ALL ROWS</pre>
</td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e41 "><strong>Messages indicating use</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e43 ">There are multiple ways in which a sorted list scan
can be indicated through the messages. The messages in this example illustrate
how the SQL Query Engine will indicate a sorted list scan was used. <ul><li>Optimizer Debug: <pre>CPI4328 -- Access path of file X1 was used by query.
CPI4325 -- Temporary result file built for query.</pre>
</li>
<li>PRTSQLINF: <pre>SQL4008 -- Index X1 used for table 1.
SQL4002 -- Reusable ODP sort used.</pre>
</li>
</ul>
</td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e41 "><strong>SMP parallel enabled</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e43 ">No</td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e41 "><strong>Also referred to as</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e43 ">Sorted List Scan, Preload <p>Sorted List Scan Distinct</p>
<p>Sorted
List Scan Distinct, Preload</p>
</td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e41 "><strong>Visual Explain icon</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e43 "><br /><img src="rzajq519.gif" alt="Sorted list scan icon" /><br /></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajqtempslist.htm" title="The temporary sorted list is a temporary object that allows the optimizer to sequence rows based upon a column or set of columns. The sorted list can be either scanned or probed by the optimizer to satisfy different operations of the query.">Temporary sorted list</a></div>
</div>
</div>
</body>
</html>