134 lines
8.0 KiB
HTML
134 lines
8.0 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="Buffer scan" />
|
||
|
<meta name="abstract" content="The buffer scan operation is used when a query is processed using DB2 UDB Symmetric Multiprocessing, yet a portion of the query is not enabled to be processed under parallelism. The buffer scan acts as a gateway to control access to rows between the parallel enabled portions of the query and the non-parallel portions." />
|
||
|
<meta name="description" content="The buffer scan operation is used when a query is processed using DB2 UDB Symmetric Multiprocessing, yet a portion of the query is not enabled to be processed under parallelism. The buffer scan acts as a gateway to control access to rows between the parallel enabled portions of the query and the non-parallel portions." />
|
||
|
<meta name="DC.subject" content="definitions, buffer scan access method, temporary buffer, scan access method, buffer, access method, buffer scan" />
|
||
|
<meta name="keywords" content="definitions, buffer scan access method, temporary buffer, scan access method, buffer, access method, buffer scan" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajqtempbuff.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="rzajqbuffscan" />
|
||
|
<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>Buffer scan</title>
|
||
|
</head>
|
||
|
<body id="rzajqbuffscan"><a name="rzajqbuffscan"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Buffer scan</h1>
|
||
|
<div><p>The buffer scan operation is used when a query is processed using DB2<sup>®</sup> UDB
|
||
|
Symmetric Multiprocessing, yet a portion of the query is not enabled to be
|
||
|
processed under parallelism. The buffer scan acts as a gateway to control
|
||
|
access to rows between the parallel enabled portions of the query and the
|
||
|
non-parallel portions.</p>
|
||
|
<div class="section"><p>Multiple threads can be used to fetch the selected rows from the
|
||
|
buffer, allowing the query to perform any remaining processing in parallel.
|
||
|
However, the buffer will be populated in a non-parallel manner.</p>
|
||
|
</div>
|
||
|
<div class="section"><p>A buffer scan operation is identical to the list scan operation
|
||
|
that is performed upon the temporary list object. The main difference is that
|
||
|
a buffer does not need to be fully populated before the start of the scan
|
||
|
operation. A temporary list requires that the list is fully populated before
|
||
|
fetching any rows.</p>
|
||
|
</div>
|
||
|
<div class="section">
|
||
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><caption>Table 1. Buffer scan attributes</caption><thead align="left"><tr><th valign="top" width="30.96446700507614%" id="d0e47">Data access method</th>
|
||
|
<th valign="top" width="69.03553299492386%" id="d0e49">Buffer scan</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody><tr><td valign="top" width="30.96446700507614%" headers="d0e47 "><strong>Description</strong></td>
|
||
|
<td valign="top" width="69.03553299492386%" headers="d0e49 ">Sequentially scan and process all of the rows in the
|
||
|
temporary buffer. Enables SMP parallelism to be performed over a non-parallel
|
||
|
portion of the query.</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="30.96446700507614%" headers="d0e47 "><strong>Advantages</strong></td>
|
||
|
<td valign="top" width="69.03553299492386%" headers="d0e49 "><ul><li>The temporary buffer can be used to enable parallelism over a portion
|
||
|
of a query that is non-parallel</li>
|
||
|
<li>The temporary buffer does not need to be fully populated in order to start
|
||
|
fetching rows</li>
|
||
|
</ul>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="30.96446700507614%" headers="d0e47 "><strong>Considerations</strong></td>
|
||
|
<td valign="top" width="69.03553299492386%" headers="d0e49 ">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="30.96446700507614%" headers="d0e47 "><strong>Likely to be used</strong></td>
|
||
|
<td valign="top" width="69.03553299492386%" headers="d0e49 "><ul><li>When the query is attempting to take advantage of DB2 UDB Symmetric Multiprocessing</li>
|
||
|
<li>When a portion of the query cannot be performed in parallel (for example,
|
||
|
index scan or index probe)</li>
|
||
|
</ul>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="30.96446700507614%" headers="d0e47 "><strong>Example SQL statement</strong></td>
|
||
|
<td valign="top" width="69.03553299492386%" headers="d0e49 "><pre>CHGQRYA DEGREE(*OPTIMIZE)
|
||
|
CREATE INDEX X1 ON
|
||
|
Employee (LastName, WorkDept)
|
||
|
|
||
|
SELECT * FROM Employee
|
||
|
WHERE WorkDept BETWEEN 'A01' AND 'E01'
|
||
|
AND LastName IN ('Smith', 'Jones', 'Peterson')
|
||
|
OPTIMIZE FOR ALL ROWS</pre>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="30.96446700507614%" headers="d0e47 "><strong>Messages indicating use</strong></td>
|
||
|
<td valign="top" width="69.03553299492386%" headers="d0e49 "><ul><li>Optimizer Debug: <pre>CPI4328 -- Access path of file X1 was used by query.
|
||
|
CPI4330 -- 8 tasks used for parallel index scan
|
||
|
of file EMPLOYEE.</pre>
|
||
|
</li>
|
||
|
<li>PRTSQLINF: <pre>SQL4027 -- Access plan was saved with DB2 UDB
|
||
|
SMP installed on the system.
|
||
|
SQL4008 -- Index X1 used for table 1.
|
||
|
SQL4011 -- Index scan-key row positioning
|
||
|
used on table 1.
|
||
|
SQL4030 -- 8 tasks specified for parallel scan
|
||
|
on table 1.</pre>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="30.96446700507614%" headers="d0e47 "><strong>SMP parallel enabled</strong></td>
|
||
|
<td valign="top" width="69.03553299492386%" headers="d0e49 ">Yes</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="30.96446700507614%" headers="d0e47 "><strong>Also referred to as</strong></td>
|
||
|
<td valign="top" width="69.03553299492386%" headers="d0e49 ">Not applicable</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="30.96446700507614%" headers="d0e47 "><strong>Visual Explain icon</strong></td>
|
||
|
<td valign="top" width="69.03553299492386%" headers="d0e49 "><br /><img src="rzajq538.gif" alt="Buffer scan icon" /><br /></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="section"><p>Using the example above, the optimizer chose to use the existing
|
||
|
index X1 to perform an index probe operation against the table. In order to
|
||
|
speed up the remaining processing for this query (for example, the Table Probe
|
||
|
operation), DB2 Symmetric
|
||
|
Multiprocessing will be used to perform the random probe into the table. Since
|
||
|
the index probe operation is not SMP parallel enabled for the SQL Query Engine,
|
||
|
that portion of the query is placed within a temporary buffer to control access
|
||
|
to the selected index entries. </p>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajqtempbuff.htm" title="The temporary buffer is a temporary object that is used to help facilitate operations such as parallelism. It is an unsorted data structure that is used to store intermediate rows of a query. The main difference between a temporary buffer and a temporary list is that the buffer does not need to be fully populated in order to allow its results to be processed.">Temporary buffer</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|