122 lines
7.7 KiB
HTML
122 lines
7.7 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="List scan" />
|
||
|
<meta name="abstract" content="The list scan operation is used when a portion of the query will be processed multiple times, but no key columns can be identified. In these cases, that portion of the query is processed once and its results are stored within the temporary list. The list can then be scanned for only those rows that satisfy any selection or processing contained within the temporary object." />
|
||
|
<meta name="description" content="The list scan operation is used when a portion of the query will be processed multiple times, but no key columns can be identified. In these cases, that portion of the query is processed once and its results are stored within the temporary list. The list can then be scanned for only those rows that satisfy any selection or processing contained within the temporary object." />
|
||
|
<meta name="DC.subject" content="definitions, list scan access method, temporary list scan, access method, list scan, access method" />
|
||
|
<meta name="keywords" content="definitions, list scan access method, temporary list scan, access method, list scan, access method" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajqtemplist.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="rzajqlistscan" />
|
||
|
<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>List scan</title>
|
||
|
</head>
|
||
|
<body id="rzajqlistscan"><a name="rzajqlistscan"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">List scan</h1>
|
||
|
<div><p>The list scan operation is used when a portion of the query will
|
||
|
be processed multiple times, but no key columns can be identified. In these
|
||
|
cases, that portion of the query is processed once and its results are stored
|
||
|
within the temporary list. The list can then be scanned for only those rows
|
||
|
that satisfy any selection or processing contained within the temporary object.</p>
|
||
|
<div class="section">
|
||
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><caption>Table 1. List scan attributes</caption><thead align="left"><tr><th valign="top" width="31.313131313131315%" id="d0e38">Data access method</th>
|
||
|
<th valign="top" width="68.68686868686868%" id="d0e40">List scan</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody><tr><td valign="top" width="31.313131313131315%" headers="d0e38 "><strong>Description</strong></td>
|
||
|
<td valign="top" width="68.68686868686868%" headers="d0e40 ">Sequentially scan and process all of the rows in the
|
||
|
temporary list.</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="31.313131313131315%" headers="d0e38 "><strong>Advantages</strong></td>
|
||
|
<td valign="top" width="68.68686868686868%" headers="d0e40 "><ul><li>The temporary list and list scan can be used by the optimizer to minimize
|
||
|
repetition of an operation or to simplify the optimizer's logic flow</li>
|
||
|
<li>Selection can be performed before generating the list to subset the number
|
||
|
of rows in the temporary object</li>
|
||
|
</ul>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="31.313131313131315%" headers="d0e38 "><strong>Considerations</strong></td>
|
||
|
<td valign="top" width="68.68686868686868%" headers="d0e40 ">Generally used to prevent portions of the query from
|
||
|
being processed multiple times when no key columns are required to satisfy
|
||
|
the request. </td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="31.313131313131315%" headers="d0e38 "><strong>Likely to be used</strong></td>
|
||
|
<td valign="top" width="68.68686868686868%" headers="d0e40 "><ul><li>When the use of temporary results is allowed by the query environmental
|
||
|
parameter (ALWCPYDTA)</li>
|
||
|
<li>When Symmetric Multiprocessing will be used for the query</li>
|
||
|
</ul>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="31.313131313131315%" headers="d0e38 "><strong>Example SQL statement</strong></td>
|
||
|
<td valign="top" width="68.68686868686868%" headers="d0e40 "><pre>SELECT * FROM Employee XXX, Department YYY
|
||
|
WHERE XXX.LastName IN ('Smith', 'Jones', 'Peterson')
|
||
|
AND YYY.DeptNo BETWEEN 'A01' AND 'E01'
|
||
|
OPTIMIZE FOR ALL ROWS</pre>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="31.313131313131315%" headers="d0e38 "><strong>Messages indicating use</strong></td>
|
||
|
<td valign="top" width="68.68686868686868%" headers="d0e40 ">There are multiple ways in which a list scan can be
|
||
|
indicated through the messages. The messages in this example illustrate how
|
||
|
the SQL Query Engine will indicate a list scan was used. <ul><li>Optimizer Debug: <pre>CPI4325 -- Temporary result file built for query.
|
||
|
CPI4327 -- File EMPLOYEE processed in join
|
||
|
position 1.
|
||
|
CPI4327 -- File DEPARTMENT processed in join
|
||
|
position 2.</pre>
|
||
|
</li>
|
||
|
<li>PRTSQLINF: <pre>SQL4007 -- Query implementation for join
|
||
|
position 1 table 1.
|
||
|
SQL4010 -- Table scan access for table 1.
|
||
|
SQL4007 -- Query implementation for join
|
||
|
position 2 table 2.
|
||
|
SQL4001 -- Temporary result created
|
||
|
SQL4010 -- Table scan access for table 2.</pre>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="31.313131313131315%" headers="d0e38 "><strong>SMP parallel enabled</strong></td>
|
||
|
<td valign="top" width="68.68686868686868%" headers="d0e40 ">Yes</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="31.313131313131315%" headers="d0e38 "><strong>Also referred to as</strong></td>
|
||
|
<td valign="top" width="68.68686868686868%" headers="d0e40 ">List Scan, Preload</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="31.313131313131315%" headers="d0e38 "><strong>Visual Explain icon</strong></td>
|
||
|
<td valign="top" width="68.68686868686868%" headers="d0e40 "><br /><img src="rzajq522.gif" alt="List scan icon" /><br /></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="section"><p>Using the example above, the optimizer chose to create a temporary
|
||
|
list to store the selected rows from the DEPARTMENT table. Since there is
|
||
|
no join criteria, a cartesian product join is performed between the two tables.
|
||
|
To prevent the join from scanning all of the rows of the DEPARTMENT table
|
||
|
for each join possibility, the selection against the DEPARTMENT table is performed
|
||
|
once and the results are stored in the temporary list. The temporary list
|
||
|
is then scanned for the cartesian product join. </p>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajqtemplist.htm" title="The temporary list is a temporary object that allows the optimizer to store intermediate results of a query. The list is an unsorted data structure that is used to simplify the operation of the query. Since the list does not have any keys, the rows within the list can only be retrieved by a sequential scan operation.">Temporary list</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|