ibm-information-center/dist/eclipse/plugins/i5OS.ic.dbmult_5.4.0.1/rcdorder.htm

65 lines
5.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="concept" />
<meta name="DC.Title" content="Implementation and optimization of record ordering with DB2 Multisystem" />
<meta name="abstract" content="When ordering is specified on a query, the ordering criteria is sent along with the query, so that each node can perform the ordering in parallel. Whether a final merge or a sort is performed on the coordinator node is dependent on the type of query that you specify." />
<meta name="description" content="When ordering is specified on a query, the ordering criteria is sent along with the query, so that each node can perform the ordering in parallel. Whether a final merge or a sort is performed on the coordinator node is dependent on the type of query that you specify." />
<meta name="DC.subject" content="record ordering, implementation, optimization, ordering, record, merge optimization, merge, record ordering optimization, sort optimization, sort, allow copy data (ALWCPYDTA) parameter, ALWCPYDTA (allow copy data) parameter, OPNQRYF (Open Query File) command, Open Query File (OPNQRYF) command, command, CL, OPNQRYF (Open Query File), Open Query File (OPNQRYF), STRSQL (Start SQL) command, Start SQL (STRSQL) command" />
<meta name="keywords" content="record ordering, implementation, optimization, ordering, record, merge optimization, merge, record ordering optimization, sort optimization, sort, allow copy data (ALWCPYDTA) parameter, ALWCPYDTA (allow copy data) parameter, OPNQRYF (Open Query File) command, Open Query File (OPNQRYF) command, command, CL, OPNQRYF (Open Query File), Open Query File (OPNQRYF), STRSQL (Start SQL) command, Start SQL (STRSQL) command" />
<meta name="DC.Relation" scheme="URI" content="qqp.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="rcdorder" />
<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>Implementation and optimization of record ordering with DB2 Multisystem</title>
</head>
<body id="rcdorder"><a name="rcdorder"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Implementation and optimization of record ordering with DB2<sup>®</sup> Multisystem</h1>
<div><p>When ordering is specified on a query, the ordering criteria is
sent along with the query, so that each node can perform the ordering in parallel.
Whether a final merge or a sort is performed on the coordinator node is dependent
on the type of query that you specify.</p>
<p>A merge of the ordered records received from each node is the most optimal.
A merge occurs as the records are received by the coordinator node. The main
performance advantage that a merge has over a sort is that the records can
be returned without having to sort all of the records from every node.</p>
<p>A sort of the ordered records received from each node causes all of the
records from each node to be read, sorted, and written to a temporary result
file before any records are returned.</p>
<p>A merge can occur if ordering is specified and no UNION and no final grouping
are required. Otherwise, for ordering queries, a final sort is performed on
the coordinator node.</p>
<p>The allow copy data (ALWCPYDTA) parameter affects how each node of the
distributed query processes the ordering criteria. The ALWCPYDTA parameter
is specified on the Open Query File (OPNQRYF) and Start SQL (STRSQL) CL commands
and also on the Create SQLxxx (CRTSQLxxx) precompiler commands:</p>
<ul><li>ALWCPYDTA(*OPTIMIZE) allows each node to choose to use either a sort or
an index to implement the ordering criteria. This option is the most optimal.</li>
<li>For the OPNQRYF command and the query API (QQQQRY), ALWCPYDTA(*YES) or
ALWCPYDTA(*NO) enforces that each node use an index that exactly matches the
specified ordering fields. This is more restrictive than how the optimizer
processes ordering for local files.</li>
</ul>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="qqp.htm" title="This topic provides you with some guidelines for designing queries so that they use query resources more efficiently when you run queries that use distributed files.">Query design for performance with DB2 Multisystem</a></div>
</div>
</div>
</body>
</html>