64 lines
3.7 KiB
HTML
64 lines
3.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="One-step grouping with DB2 Multisystem" />
|
|
<meta name="abstract" content="If all the fields from the partitioning key are GROUP BY fields, then grouping can be performed using one-step grouping, because all of the data for the group is on the same node." />
|
|
<meta name="description" content="If all the fields from the partitioning key are GROUP BY fields, then grouping can be performed using one-step grouping, because all of the data for the group is on the same node." />
|
|
<meta name="DC.subject" content="grouping, one-step, optimization, one-step grouping" />
|
|
<meta name="keywords" content="grouping, one-step, optimization, one-step grouping" />
|
|
<meta name="DC.Relation" scheme="URI" content="grouping.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="onestep" />
|
|
<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>One-step grouping with DB2 Multisystem</title>
|
|
</head>
|
|
<body id="onestep"><a name="onestep"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">One-step grouping with DB2<sup>®</sup> Multisystem</h1>
|
|
<div><p>If all the fields from the partitioning key are GROUP BY fields,
|
|
then grouping can be performed using one-step grouping, because all of the
|
|
data for the group is on the same node.</p>
|
|
<div class="section"><p>The following code is an example of one-step grouping.
|
|
</p>
|
|
<p>SQL statement:</p>
|
|
<pre> SELECT WORKDEPT, AVG(SALARY)
|
|
FROM EMPLOYEE
|
|
GROUP BY WORKDEPT
|
|
</pre>
|
|
<p>OPNQRYF command:</p>
|
|
<pre> OPNQRYF FILE((EMPLOYEE)) FORMAT(GRPFMT)
|
|
GRPFLD(WORKDEPT)
|
|
MAPFLD((AVGSAL '%AVG(SALARY)'))</pre>
|
|
<p>Because
|
|
WORKDEPT is both the partitioning key and the grouping field, all like values
|
|
of WORKDEPT are on the same nodes; for example, all values of A00 are on SYSA,
|
|
all values of A01 are on SYSB, all values of B00 are on SYSC, and all values
|
|
of B01 are on SYSA. The grouping is performed in parallel on all three
|
|
nodes.</p>
|
|
<p>To implement one-step grouping, all of the fields of the partitioning
|
|
key must be grouping fields. Additional nonpartitioning key fields can also
|
|
be grouping fields.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="grouping.htm" title="The implementation method for grouping in queries that use distributed files is dependent on whether the partitioning key is included in the grouping criteria.">Implementation and optimization of grouping with DB2 Multisystem</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |