182 lines
10 KiB
HTML
182 lines
10 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="Repartitioned join with DB2 Multisystem" />
|
|
<meta name="abstract" content="In a repartitioned join, the partitioning keys of the files are not used as the join fields." />
|
|
<meta name="description" content="In a repartitioned join, the partitioning keys of the files are not used as the join fields." />
|
|
<meta name="DC.subject" content="query, repartitioned join, join, repartitioned, example, repartitioned join query" />
|
|
<meta name="keywords" content="query, repartitioned join, join, repartitioned, example, repartitioned join query" />
|
|
<meta name="DC.Relation" scheme="URI" content="joins.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="repartitioned" />
|
|
<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>Repartitioned join with DB2 Multisystem</title>
|
|
</head>
|
|
<body id="repartitioned"><a name="repartitioned"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Repartitioned join with DB2<sup>®</sup> Multisystem</h1>
|
|
<div><p>In a repartitioned join, the partitioning keys of the files are
|
|
not used as the join fields.</p>
|
|
<div class="section"><p>Records of both files must be moved by hashing the join field
|
|
values of each of the files. Because neither of the files' partitioning key
|
|
fields are included in the join criteria, the files must be repartitioned
|
|
by hashing on a new partitioning key that includes one or more of the join
|
|
fields. This method is valid only for equijoin queries. </p>
|
|
<p>SQL statement:</p>
|
|
<pre> SELECT DEPTNAME, FIRSTNME, LASTNAME
|
|
FROM DEPARTMENT, EMPLOYEE
|
|
WHERE MGRNO = EMPNO</pre>
|
|
<p>OPNQRYF command:</p>
|
|
<pre> OPNQRYF FILE((DEPARTMENT) (EMPLOYEE))
|
|
FORMAT(JOINFMT)
|
|
JFLD((MGRNO EMPNO *EQ))</pre>
|
|
<p>In this example,
|
|
the data must be redistributed because neither MGRNO nor EMPNO is a partitioning
|
|
key.</p>
|
|
<p>Data from DEPARTMENT is redistributed:</p>
|
|
|
|
<table cellpadding="4" cellspacing="0" border="1" class="tableborder"><tr><td>
|
|
<table cellpadding="4" cellspacing="0" summary="" border="0"><caption>Table 1. Redistributed
|
|
DEPARTMENT data</caption><thead align="left"><tr><th align="center" valign="bottom" width="25%" id="d0e76">Old node</th>
|
|
<th align="center" valign="bottom" width="25%" id="d0e78">New node</th>
|
|
<th align="left" valign="bottom" width="25%" id="d0e80">DEPTNAME</th>
|
|
<th align="center" valign="bottom" width="25%" id="d0e82">MGRNO (New partitioning key)</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr><td align="center" valign="top" width="25%" headers="d0e76 ">SYSA</td>
|
|
<td align="center" valign="top" width="25%" headers="d0e78 ">SYSB</td>
|
|
<td align="left" valign="top" width="25%" headers="d0e80 ">Support services</td>
|
|
<td align="center" valign="top" width="25%" headers="d0e82 ">000010</td>
|
|
</tr>
|
|
<tr><td align="center" valign="top" width="25%" headers="d0e76 ">SYSB</td>
|
|
<td align="center" valign="top" width="25%" headers="d0e78 ">SYSB</td>
|
|
<td align="left" valign="top" width="25%" headers="d0e80 ">Planning</td>
|
|
<td align="center" valign="top" width="25%" headers="d0e82 ">000010</td>
|
|
</tr>
|
|
<tr><td align="center" valign="top" width="25%" headers="d0e76 ">SYSC</td>
|
|
<td align="center" valign="top" width="25%" headers="d0e78 ">SYSC</td>
|
|
<td align="left" valign="top" width="25%" headers="d0e80 ">Accounting</td>
|
|
<td align="center" valign="top" width="25%" headers="d0e82 ">000050</td>
|
|
</tr>
|
|
<tr><td align="center" valign="top" width="25%" headers="d0e76 ">SYSA</td>
|
|
<td align="center" valign="top" width="25%" headers="d0e78 ">SYSC</td>
|
|
<td align="left" valign="top" width="25%" headers="d0e80 ">Programming</td>
|
|
<td align="center" valign="top" width="25%" headers="d0e82 ">000050</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</td></tr></table>
|
|
<p>Data from EMPLOYEE is redistributed:</p>
|
|
|
|
<table cellpadding="4" cellspacing="0" border="1" class="tableborder"><tr><td>
|
|
<table cellpadding="4" cellspacing="0" summary="" border="0"><caption>Table 2. Redistributed
|
|
EMPLOYEE data</caption><thead align="left"><tr><th align="center" valign="bottom" width="20%" id="d0e134">Old node</th>
|
|
<th align="center" valign="bottom" width="20%" id="d0e136">New node</th>
|
|
<th align="left" valign="bottom" width="20%" id="d0e138">FIRSTNME</th>
|
|
<th align="left" valign="bottom" width="20%" id="d0e140">LASTNAME</th>
|
|
<th align="center" valign="bottom" width="20%" id="d0e142">EMPNO (New partitioning key)</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr><td align="center" valign="top" width="20%" headers="d0e134 ">SYSA</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e136 ">SYSB</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e138 ">Christine</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e140 ">Haas</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e142 ">000010</td>
|
|
</tr>
|
|
<tr><td align="center" valign="top" width="20%" headers="d0e134 ">SYSA</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e136 ">SYSC</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e138 ">Sally</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e140 ">Kwan</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e142 ">000020</td>
|
|
</tr>
|
|
<tr><td align="center" valign="top" width="20%" headers="d0e134 ">SYSB</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e136 ">SYSA</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e138 ">John</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e140 ">Geyer</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e142 ">000030</td>
|
|
</tr>
|
|
<tr><td align="center" valign="top" width="20%" headers="d0e134 ">SYSB</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e136 ">SYSB</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e138 ">Irving</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e140 ">Stern</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e142 ">000040</td>
|
|
</tr>
|
|
<tr><td align="center" valign="top" width="20%" headers="d0e134 ">SYSC</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e136 ">SYSC</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e138 ">Michael</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e140 ">Thompson</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e142 ">000050</td>
|
|
</tr>
|
|
<tr><td align="center" valign="top" width="20%" headers="d0e134 ">SYSC</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e136 ">SYSA</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e138 ">Eileen</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e140 ">Henderson</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e142 ">000060</td>
|
|
</tr>
|
|
<tr><td align="center" valign="top" width="20%" headers="d0e134 ">SYSA</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e136 ">SYSB</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e138 ">Jennifer</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e140 ">Lutz</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e142 ">000070</td>
|
|
</tr>
|
|
<tr><td align="center" valign="top" width="20%" headers="d0e134 ">SYSA</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e136 ">SYSC</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e138 ">David</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e140 ">White</td>
|
|
<td align="center" valign="top" width="20%" headers="d0e142 ">000080</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</td></tr></table>
|
|
<p>Records returned by this query:</p>
|
|
|
|
<table cellpadding="4" cellspacing="0" border="1" class="tableborder"><tr><td>
|
|
<table cellpadding="4" cellspacing="0" summary="" border="0"><caption>Table 3. Display
|
|
of the query results</caption><thead align="left"><tr><th align="left" valign="bottom" width="33.33333333333333%" id="d0e244">DEPTNAME</th>
|
|
<th align="left" valign="bottom" width="33.33333333333333%" id="d0e246">FIRSTNME</th>
|
|
<th align="left" valign="bottom" width="33.33333333333333%" id="d0e248">LASTNAME</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr><td align="left" valign="top" width="33.33333333333333%" headers="d0e244 ">Support services</td>
|
|
<td align="left" valign="top" width="33.33333333333333%" headers="d0e246 ">Christine</td>
|
|
<td align="left" valign="top" width="33.33333333333333%" headers="d0e248 ">Haas</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="33.33333333333333%" headers="d0e244 ">Planning</td>
|
|
<td align="left" valign="top" width="33.33333333333333%" headers="d0e246 ">Christine</td>
|
|
<td align="left" valign="top" width="33.33333333333333%" headers="d0e248 ">Haas</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="33.33333333333333%" headers="d0e244 ">Accounting</td>
|
|
<td align="left" valign="top" width="33.33333333333333%" headers="d0e246 ">Michael</td>
|
|
<td align="left" valign="top" width="33.33333333333333%" headers="d0e248 ">Thompson</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="33.33333333333333%" headers="d0e244 ">Programming</td>
|
|
<td align="left" valign="top" width="33.33333333333333%" headers="d0e246 ">Michael</td>
|
|
<td align="left" valign="top" width="33.33333333333333%" headers="d0e248 ">Thompson</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</td></tr></table>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="joins.htm" title="In addition to the performance considerations for nondistributed join queries, more performance considerations exist for queries involving distributed files.">Implementation and optimization of join operations with DB2 Multisystem</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |