86 lines
6.6 KiB
HTML
86 lines
6.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="Automatic statistics collection" />
|
|
<meta name="abstract" content="When the Statistics Manager prepares its responses to the Optimizer, it keeps track of the responses that are generated by using default filter factors (because column statistics or indexes were not available). It uses this information during the time that the access plan is being written to the Plan Cache to automatically generate a statistic collection request for the columns. If system resources allow it, the Statistics Manager generates statistics collections in real time for direct use by the current query, avoiding a default answer to the Optimizer." />
|
|
<meta name="description" content="When the Statistics Manager prepares its responses to the Optimizer, it keeps track of the responses that are generated by using default filter factors (because column statistics or indexes were not available). It uses this information during the time that the access plan is being written to the Plan Cache to automatically generate a statistic collection request for the columns. If system resources allow it, the Statistics Manager generates statistics collections in real time for direct use by the current query, avoiding a default answer to the Optimizer." />
|
|
<meta name="DC.subject" content="statistics manager, automatic statistics collection" />
|
|
<meta name="keywords" content="statistics manager, automatic statistics collection" />
|
|
<meta name="DC.Relation" scheme="URI" content="statsmanager.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="autostats" />
|
|
<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>Automatic statistics collection</title>
|
|
</head>
|
|
<body id="autostats"><a name="autostats"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Automatic statistics collection</h1>
|
|
<div><p>When the Statistics Manager prepares its responses to the Optimizer,
|
|
it keeps track of the responses that are generated by using default filter
|
|
factors (because column statistics or indexes were not available). It uses
|
|
this information during the time that the access plan is being written to
|
|
the Plan Cache to automatically generate a statistic collection request for
|
|
the columns. If system resources allow it, the Statistics Manager generates
|
|
statistics collections in real time for direct use by the current query, avoiding
|
|
a default answer to the Optimizer.</p>
|
|
<div class="section"><p>Otherwise, as system resources become available, the requested
|
|
column statistics will be collected in the background. That way, the next
|
|
time that the query is executed, the missing column statistics will be available
|
|
to the Statistics Manager, thus allowing it to provide more accurate information
|
|
to the Optimizer at that time. More statistics make it easier for the Optimizer
|
|
to generate a good performing access plan.</p>
|
|
</div>
|
|
<div class="section"><p>If a query is canceled before or during execution, the requests
|
|
for column statistics are still processed, as long as the execution reaches
|
|
the point where the generated access plan is written to the Plan Cache.</p>
|
|
</div>
|
|
<div class="section"><p>To minimize the number of passes through a table during statistics
|
|
collection, the Statistics Manger groups multiple requests for the same table
|
|
together. For example, two queries are executed against table T1. The first
|
|
query has selection criteria on column C1 and the second over column C2. If
|
|
no statistics are available for the table, the Statistics Manager identifies
|
|
both of these columns as good candidates for column statistics. When the Statistics
|
|
Manager reviews requests, it looks for multiple requests for the same table
|
|
and groups them together into one request. This allows both column statistics
|
|
to be created with only one pass through table T1.</p>
|
|
</div>
|
|
<div class="section"><p>One thing to note is that column statistics normally are automatically
|
|
created when the Statistics Manager must answer questions from the optimizer
|
|
using default filter factors. However, when an index is available that might
|
|
be used to generate the answer, then column statistics are not automatically
|
|
generated. There may be cases where optimization time would benefit from column
|
|
statistics in this scenario because using column statistics to answer questions
|
|
from the optimizer is generally more efficient than using the index data.
|
|
So if you have cases where the query performance seems extended, you might
|
|
want to verify that there is are indexes over the relevant columns in your
|
|
query. If this is the case, try manually generating columns statistics for
|
|
these columns.</p>
|
|
</div>
|
|
<div class="section"><p>As stated before, statistics collection occurs as system resources
|
|
become available. If you have schedule a low priority job that is permanently
|
|
active on your system and that is supposed to use all spare CPU cycles for
|
|
processing, your statistics collection will never become active.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="statsmanager.htm" title="As stated earlier, the collection of statistics is handled by a separate component called the Statistics Manager. Statistical information can be used by the query optimizer to determine the best access plan for a query. Since the query optimizer bases its choice of access plan on the statistical information found in the table, it is important that this information be current.">Collecting statistics with the Statistics Manager</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |