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

115 lines
7.3 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="Table scan" />
<meta name="abstract" content="A table scan is the easiest and simplest operation that can be performed against a table. It sequentially processes all of the rows in the table to determine if they satisfy the selection criteria specified in the query. It does this in a way to maximize the I/O throughput for the table." />
<meta name="description" content="A table scan is the easiest and simplest operation that can be performed against a table. It sequentially processes all of the rows in the table to determine if they satisfy the selection criteria specified in the query. It does this in a way to maximize the I/O throughput for the table." />
<meta name="DC.subject" content="definitions, table scan, access method, table scan" />
<meta name="keywords" content="definitions, table scan, access method, table scan" />
<meta name="DC.Relation" scheme="URI" content="rzajqcrttbl.htm" />
<meta name="DC.Relation" scheme="URI" content="c23nl.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="dsscan" />
<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>Table scan</title>
</head>
<body id="dsscan"><a name="dsscan"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Table scan</h1>
<div><p>A table scan is the easiest and simplest operation that can be
performed against a table. It sequentially processes all of the rows in the
table to determine if they satisfy the selection criteria specified in the
query. It does this in a way to maximize the I/O throughput for the table.</p>
<div class="section"><p>A table scan operation requests large I/Os to bring as many rows
as possible into main memory for processing. It also asynchronously pre-fetches
the data to make sure that the table scan operation is never waiting for rows
to be paged into memory. Table scan however, has a disadvantage in it has
to process all of the rows in order to satisfy the query. The scan operation
itself is very efficient if it does not need to perform the I/O synchronously. </p>
</div>
<div class="section">
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><caption>Table 1. Table scan attributes</caption><thead align="left"><tr><th valign="top" width="31.313131313131315%" id="d0e40">Data access method</th>
<th valign="top" width="68.68686868686868%" id="d0e42">Table scan</th>
</tr>
</thead>
<tbody><tr><td valign="top" width="31.313131313131315%" headers="d0e40 "><strong>Description</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e42 ">Reads all of the rows from the table and applies the
selection criteria to each of the rows within the table. The rows in the table
are processed in no guaranteed order, but typically they are processed sequentially.
</td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e40 "><strong>Advantages</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e42 "><ul><li>Minimizes page I/O operations through asynchronous pre-fetching of the
rows since the pages are scanned sequentially</li>
<li> Requests a larger I/O to fetch the data efficiently</li>
</ul>
</td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e40 "><strong>Considerations</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e42 "><ul><li>All rows in the table are examined regardless of the selectivity of the
query</li>
<li>Rows marked as deleted are still paged into memory even though none will
be selected. You can reorganize the table to remove deleted rows.</li>
</ul>
</td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e40 "><strong>Likely to be used</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e42 "><ul><li>When expecting a large number of rows returned from the table</li>
<li>When the number of large I/Os needed to scan is fewer than the number
of small I/Os required to probe the table</li>
</ul>
</td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e40 "><strong>Example SQL statement</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e42 "><pre>SELECT * FROM Employee
WHERE WorkDept BETWEEN 'A01'AND 'E01'
OPTIMIZE FOR ALL ROWS</pre>
</td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e40 "><strong>Messages indicating use</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e42 "><ul><li>Optimizer Debug: <pre>CPI4329 — Arrival sequence was used for file EMPLOYEE </pre>
</li>
<li>PRTSQLINF: <pre>SQL4010 — Table scan access for table 1.</pre>
</li>
</ul>
</td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e40 "><strong>SMP parallel enabled</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e42 ">Yes</td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e40 "><strong>Also referred to as</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e42 ">Table Scan, Preload</td>
</tr>
<tr><td valign="top" width="31.313131313131315%" headers="d0e40 "><strong>Visual Explain icon</strong></td>
<td valign="top" width="68.68686868686868%" headers="d0e42 "><br /><img src="rzajq504.gif" alt="Table scan icon" /><br /></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajqcrttbl.htm" title="An SQL table or physical file is the base object for a query. It represents the source of the data used to produce the result set for the query. It is created by the user and specified in the FROM clause (or OPNQRYF FILE parameter).">Table</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="c23nl.htm" title="DB2 Universal Database for iSeries provides a nested loop join method. For this method, the processing of the tables in the join are ordered. This order is called the join order. The first table in the final join order is called the primary table. The other tables are called secondary tables. Each join table position is called a dial.">Nested loop join implementation</a></div>
</div>
</div>
</body>
</html>