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

75 lines
4.4 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="Optimizer decision-making rules" />
<meta name="abstract" content="In performing its function, Optimizer uses a general set of guidelines to choose the best method for accessing data." />
<meta name="description" content="In performing its function, Optimizer uses a general set of guidelines to choose the best method for accessing data." />
<meta name="DC.Relation" scheme="URI" content="rzaikoptimizer.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="optdecrules" />
<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>Optimizer decision-making rules</title>
</head>
<body id="optdecrules"><a name="optdecrules"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Optimizer decision-making rules</h1>
<div><p>In performing its function, Optimizer uses a general set of guidelines
to choose the best method for accessing data.</p>
<div class="section"><p>Optimizer does the following: </p>
<ul><li>Determines the default filter factor for each predicate in the selection
clause.</li>
<li>Extracts attributes of the table from internally stored information.</li>
<li>Performs an estimate key range to determine the true filter factor of
the predicates when the selection predicates match the left-most keys of an
index.</li>
<li>Determines the cost of creating an index over a table if an index is required.</li>
<li>Determines the cost of using a sort routine if selection conditions apply
and an index is required.</li>
<li>Determines the cost of dataspace scan processing if an index is not required.</li>
<li>For each index available, in the order of most recently created to oldest,
Optimizer does the following until its time limit is exceeded: <ul><li>Extracts attributes of the index from internally stored statistics.</li>
<li>Determines if the index meets the selection criteria.</li>
<li>Determines the cost of using the index using the estimated page faults
and the predicate filter factors to help determine the cost.</li>
<li>Compares the cost of using this index with the previous cost (current
best).</li>
<li>Selects the cheapest one.</li>
<li>Continues to search for best index until time out or no more indexes.</li>
</ul>
</li>
</ul>
</div>
<div class="section"><p>The time limit factor controls how much time is spent choosing
an implementation. It is based on how much time has been spent and the current
best implementation cost found. Dynamic <span class="keyword">SQL</span> queries
are subject to Optimizer time restrictions. Static <span class="keyword">SQL</span> queries
optimization time is not limited.</p>
</div>
<div class="section"><p>For small tables, the query Optimizer spends little time in query
optimization. For large tables, the query Optimizer considers more indexes.
Generally, Optimizer considers five or six indexes (for each table of a join)
before running out of optimization time.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaikoptimizer.htm" title="Optimizer is an important module of the i5/OS Query component because it makes the key decisions for good database performance. Its main objective is to find the most efficient access path to the data.">Optimizer</a></div>
</div>
</div>
</body>
</html>