69 lines
4.6 KiB
HTML
69 lines
4.6 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="Optimizing grouping by eliminating grouping columns" />
|
||
|
<meta name="abstract" content="All of the grouping columns are evaluated to determine if they can be removed from the list of grouping columns. Only those grouping columns that have isolatable selection predicates with an equal operator specified can be considered. This guarantees that the column can only match a single value and will not help determine a unique group." />
|
||
|
<meta name="description" content="All of the grouping columns are evaluated to determine if they can be removed from the list of grouping columns. Only those grouping columns that have isolatable selection predicates with an equal operator specified can be considered. This guarantees that the column can only match a single value and will not help determine a unique group." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="groupopt.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="rzajqgroupcols" />
|
||
|
<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>Optimizing grouping by eliminating grouping columns</title>
|
||
|
</head>
|
||
|
<body id="rzajqgroupcols"><a name="rzajqgroupcols"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Optimizing grouping by eliminating grouping columns</h1>
|
||
|
<div><p>All of the grouping columns are evaluated to determine if they
|
||
|
can be removed from the list of grouping columns. Only those grouping columns
|
||
|
that have isolatable selection predicates with an equal operator specified
|
||
|
can be considered. This guarantees that the column can only match a single
|
||
|
value and will not help determine a unique group.</p>
|
||
|
<div class="section"><p> This processing is done to allow the optimizer to consider more
|
||
|
indexes to implement the query and to reduce the number of columns that will
|
||
|
be added as key columns to a temporary index or hash table.</p>
|
||
|
</div>
|
||
|
<div class="section"><p>The following example illustrates a query where the optimizer
|
||
|
might eliminate a grouping column. </p>
|
||
|
<pre> <strong>DECLARE</strong> DEPTEMP <strong>CURSOR FOR
|
||
|
SELECT</strong> EMPNO, LASTNAME, WORKDEPT
|
||
|
<strong>FROM</strong> CORPDATA.EMPLOYEE
|
||
|
<strong>WHERE</strong> EMPNO = '000190'
|
||
|
<strong>GROUP BY</strong> EMPNO, LASTNAME, WORKDEPT</pre>
|
||
|
</div>
|
||
|
<div class="section"><p>OPNQRYF example: </p>
|
||
|
<pre>OPNQRYF FILE(EMPLOYEE) FORMAT(FORMAT1)
|
||
|
QRYSLT('EMPNO *EQ ''000190''')
|
||
|
GRPFLD(EMPNO LASTNAME WORKDEPT)</pre>
|
||
|
</div>
|
||
|
<div class="section"><p>In this example, the optimizer can remove EMPNO from the list
|
||
|
of grouping columns because of the <samp class="codeph">EMPNO = '000190'</samp> selection
|
||
|
predicate. An index that only has LASTNAME and WORKDEPT specified as key columns
|
||
|
can be considered to implement the query and if a temporary index or hash
|
||
|
is required then EMPNO will not be used. </p>
|
||
|
<div class="note"><span class="notetitle">Note:</span> Even though EMPNO can be
|
||
|
removed from the list of grouping columns, the optimizer might still choose
|
||
|
to use that index if a permanent index exists with all three grouping columns.</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="groupopt.htm" title="DB2 Universal Database for iSeries has certain techniques to use when the optimizer encounters grouping. The query optimizer chooses its methods for optimizing your query.">Grouping optimization</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|