ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzaik_5.4.0.1/indexes.htm

79 lines
4.1 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="Use indexes" />
<meta name="abstract" content="The use of indexes can improve significantly the performance of your applications." />
<meta name="description" content="The use of indexes can improve significantly the performance of your applications." />
<meta name="DC.Relation" scheme="URI" content="rzaikdbdesign.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="indexes" />
<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>Use indexes</title>
</head>
<body id="indexes"><a name="indexes"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use indexes</h1>
<div><p>The use of indexes can improve significantly the performance of
your applications. </p>
<div class="section"><p>This is because the <a href="rzaikoptimizer.htm#optimizer">Optimizer</a> uses
them for performance optimization. Indexes are created in five different ways:
</p>
<ul><li>CREATE INDEX (in <span class="keyword">SQL</span>)</li>
<li>CRTPF, with key</li>
<li>CRTLF, with key</li>
<li>CRTLF, as join logical file</li>
<li>CRTLF, with select/omit specifications, without a key, and without dynamic
selection (DYNSLT).</li>
</ul>
</div>
<div class="section"><p>Indexes are used to enable row selection by means of index-versus-table
scanning, which is usually slower. Table scanning sequentially processes all
rows in a table. If a permanent index is available, building a temporary index
can be avoided. Indexes are required for: </p>
<ul><li>Join tables</li>
<li>ORDER BY</li>
<li>GROUP BY</li>
</ul>
</div>
<div class="section"><p>Indexes will be created, if no permanent index exists.</p>
</div>
<div class="section"><p>Manage the number of indexes to minimize the extra server cost
of maintaining the indexes during update operations. Below are general rules
for particular types of tables: </p>
<dl><dt class="dlterm">Primarily read-only tables:</dt>
<dd>Create indexes over columns as needed. Consider creating an index only
if a table is greater than approximately 1,000 rows or is going to be used
with ORDER BY, GROUP BY, or join processing. Index maintenance could be costlier
than occasionally scanning the entire table.</dd>
<dt class="dlterm">Primarily read-only table, with low update rate:</dt>
<dd>Create indexes over columns as needed. Avoid building indexes over columns
that are updated frequently. INSERT, UPDATE, and DELETE will cause maintenance
to all indexes related to the table.</dd>
<dt class="dlterm">High update-rate tables:</dt>
<dd>Avoid creating many indexes. An example of a table that has a high update
rate is a logging or a history table.</dd>
</dl>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaikdbdesign.htm" title="Use the following topics to determine what tables you require in your database and to understand the relationship between those tables.">Database design</a></div>
</div>
</div>
</body>
</html>