<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Analyze this!</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2009/04/30/analyze-this/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2009/04/30/analyze-this/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Wed, 22 May 2013 12:40:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: I Wish &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/30/analyze-this/#comment-43229</link>
		<dc:creator><![CDATA[I Wish &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Fri, 16 Dec 2011 18:32:38 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1091#comment-43229</guid>
		<description><![CDATA[[...] chained and migrated rows counted separately in dba_tables when we run the packaged procedure. The optimizer will use information about chained or migrated rows, but the information is only collected if you use the analyze command (and even then the two [...]]]></description>
		<content:encoded><![CDATA[<p>[...] chained and migrated rows counted separately in dba_tables when we run the packaged procedure. The optimizer will use information about chained or migrated rows, but the information is only collected if you use the analyze command (and even then the two [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/30/analyze-this/#comment-36679</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Sun, 04 Jul 2010 09:31:32 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1091#comment-36679</guid>
		<description><![CDATA[Bruce,

That&#039;s an interesting observation - unfortunately my first attempt to emulate your results on 10.2.0.3 and 9.2.0.8 failed.

I modified the test scripts from the original blog, and added code after the  example with the ANALYZE command to use dbms_stats.gather_table_stats() again - which left the chain_cnt in place.  The resulting execution path (and 10053 trace) showed that Oracle still considered the chain_cnt.

First observation - when you use &lt;strong&gt;dbms_stats&lt;/strong&gt; the &lt;strong&gt;global_stats&lt;/strong&gt; column on &lt;strong&gt;user_tables&lt;/strong&gt; is set to &#039;YES&#039;, when you use &lt;strong&gt;analyze &lt;/strong&gt;it is set to &#039;NO&#039;.  Possibly there are some versions of Oracle where the handling of &lt;strong&gt;chain_cnt &lt;/strong&gt;is dependent on that flag.  

Can you give an example of the code sequence you used to produce your results.]]></description>
		<content:encoded><![CDATA[<p>Bruce,</p>
<p>That&#8217;s an interesting observation &#8211; unfortunately my first attempt to emulate your results on 10.2.0.3 and 9.2.0.8 failed.</p>
<p>I modified the test scripts from the original blog, and added code after the  example with the ANALYZE command to use dbms_stats.gather_table_stats() again &#8211; which left the chain_cnt in place.  The resulting execution path (and 10053 trace) showed that Oracle still considered the chain_cnt.</p>
<p>First observation &#8211; when you use <strong>dbms_stats</strong> the <strong>global_stats</strong> column on <strong>user_tables</strong> is set to &#8216;YES&#8217;, when you use <strong>analyze </strong>it is set to &#8216;NO&#8217;.  Possibly there are some versions of Oracle where the handling of <strong>chain_cnt </strong>is dependent on that flag.  </p>
<p>Can you give an example of the code sequence you used to produce your results.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruce Zikmund</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/30/analyze-this/#comment-36676</link>
		<dc:creator><![CDATA[Bruce Zikmund]]></dc:creator>
		<pubDate>Sat, 03 Jul 2010 20:30:24 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1091#comment-36676</guid>
		<description><![CDATA[I don&#039;t believe CHAIN_CNT is actually used by the optimizer - at least not in my experience with 9i or 10g.  In the past I have encountered several tables with high migrated rows, however, CHAIN_CNT = 0 because dbms_stats() doesn&#039;t compute CHAIN_CNT!  I performed a 10053 trace on a query against this table, and then again after an ANALYLZE COMPUTE STATISTICS, and found a different costing as is mentioned above.  However, after re-applying dbms_stats() after the ANALYZE, the 10053 trace costing model reverted back to the pre-ANALYZE state, even though CHAIN_CNT retained its high non-zero value.  Thus a technique I often use is to run a periodic sweep through the database using ANALYZE to identify those tables with increasing CHAIN_CNT - and then, immediately follow-up with dbms_stats() so as to revert to the dbms_stats costing.  This enables computation of the optimum PCTFREE while not signficantly compromising the execution plans.  It is also very helpful to identify tables that need to be reorganized (e.g., ALTER TABLE xxx MOVE).  It would be nice to know why dbms_stats() dropped support for CHAIN_CNT in the first place as it can be a very useful statistic.]]></description>
		<content:encoded><![CDATA[<p>I don&#8217;t believe CHAIN_CNT is actually used by the optimizer &#8211; at least not in my experience with 9i or 10g.  In the past I have encountered several tables with high migrated rows, however, CHAIN_CNT = 0 because dbms_stats() doesn&#8217;t compute CHAIN_CNT!  I performed a 10053 trace on a query against this table, and then again after an ANALYLZE COMPUTE STATISTICS, and found a different costing as is mentioned above.  However, after re-applying dbms_stats() after the ANALYZE, the 10053 trace costing model reverted back to the pre-ANALYZE state, even though CHAIN_CNT retained its high non-zero value.  Thus a technique I often use is to run a periodic sweep through the database using ANALYZE to identify those tables with increasing CHAIN_CNT &#8211; and then, immediately follow-up with dbms_stats() so as to revert to the dbms_stats costing.  This enables computation of the optimum PCTFREE while not signficantly compromising the execution plans.  It is also very helpful to identify tables that need to be reorganized (e.g., ALTER TABLE xxx MOVE).  It would be nice to know why dbms_stats() dropped support for CHAIN_CNT in the first place as it can be a very useful statistic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/30/analyze-this/#comment-36478</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Sat, 12 Jun 2010 14:30:19 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1091#comment-36478</guid>
		<description><![CDATA[Girish:

I&#039;m sorry, I still don&#039;t understand what your question is.  You say: &lt;i&gt;&quot;My request is what are implications of existence of chain_cnt in stats? Will it influence to calculate index access path?&quot;&lt;/i&gt;

But the article is about the effects of analyze and the chain_cnt value, and includes an example with the following comment:
&lt;blockquote&gt;
&quot;The cost of the query changed so much after the analyze that I had to put in a hint to force Oracle to use the index.&quot;
&lt;/blockquote&gt;
This seems to address the question you appear to be asking.]]></description>
		<content:encoded><![CDATA[<p>Girish:</p>
<p>I&#8217;m sorry, I still don&#8217;t understand what your question is.  You say: <i>&#8220;My request is what are implications of existence of chain_cnt in stats? Will it influence to calculate index access path?&#8221;</i></p>
<p>But the article is about the effects of analyze and the chain_cnt value, and includes an example with the following comment:</p>
<blockquote><p>
&#8220;The cost of the query changed so much after the analyze that I had to put in a hint to force Oracle to use the index.&#8221;
</p></blockquote>
<p>This seems to address the question you appear to be asking.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Girish Sharma</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/30/analyze-this/#comment-36473</link>
		<dc:creator><![CDATA[Girish Sharma]]></dc:creator>
		<pubDate>Fri, 11 Jun 2010 06:23:30 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1091#comment-36473</guid>
		<description><![CDATA[You are saying something very different; while i wish to request something very different.  I am not saying that you have said that dbms_stats will collect more smart/worthy stats; its my opinion; assumption.  My request is what are implications of existence of chain_cnt in stats?  Will it influence to calculate index access path?  If yes; then how? (for which you have this blog entry in reference of above OTN thread in which OP is somewhat confused regarding export/import Vs Stats of chained rows).

Best Regards
Girish Sharma]]></description>
		<content:encoded><![CDATA[<p>You are saying something very different; while i wish to request something very different.  I am not saying that you have said that dbms_stats will collect more smart/worthy stats; its my opinion; assumption.  My request is what are implications of existence of chain_cnt in stats?  Will it influence to calculate index access path?  If yes; then how? (for which you have this blog entry in reference of above OTN thread in which OP is somewhat confused regarding export/import Vs Stats of chained rows).</p>
<p>Best Regards<br />
Girish Sharma</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/30/analyze-this/#comment-36465</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Thu, 10 Jun 2010 09:30:18 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1091#comment-36465</guid>
		<description><![CDATA[&quot;You are highlighting ...&quot; 
The previous response to Henry states explicitly what I was trying to highlight.

&quot;most worth full statistics&quot; I did not say that using dbms_stats means you get &quot;nost worth full statistics&quot;, I said that Oracle Corp. has been telling you for years to use dbms_stats and not analyze - you&#039;re &lt;b&gt;supposed&lt;/b&gt; to use dbms_stats() - whether or not the statistics it gives are &quot;better&quot; or &quot;worse&quot;.


&quot;Which one is good?&quot; The best path for a query may be one that the optimizer doesn&#039;t find, regardless of what statistics you&#039;ve got. The important point is that analyze and dbms_stats() generate different stats and therefore may give you different paths -- either strategy could give you the better paths some of your queries and worse paths for other queries.

&quot;no/minor impact&quot;. The blog shows an example where the impact of changing from analyze to dbms_stats() is not minor.  Consistent means &quot;always does the same thing&quot;, which means, amongst other things: &quot;always makes the same mistakes&quot;.  If, for a given version of Oracle, you always use analyze, the optimizer will always make same mistakes; if you always use dbms_stats() the optimizer will make a different set of mistakes - but it will always make the same &quot;different&quot; set of mistakes.]]></description>
		<content:encoded><![CDATA[<p>&#8220;You are highlighting &#8230;&#8221;<br />
The previous response to Henry states explicitly what I was trying to highlight.</p>
<p>&#8220;most worth full statistics&#8221; I did not say that using dbms_stats means you get &#8220;nost worth full statistics&#8221;, I said that Oracle Corp. has been telling you for years to use dbms_stats and not analyze &#8211; you&#8217;re <b>supposed</b> to use dbms_stats() &#8211; whether or not the statistics it gives are &#8220;better&#8221; or &#8220;worse&#8221;.</p>
<p>&#8220;Which one is good?&#8221; The best path for a query may be one that the optimizer doesn&#8217;t find, regardless of what statistics you&#8217;ve got. The important point is that analyze and dbms_stats() generate different stats and therefore may give you different paths &#8212; either strategy could give you the better paths some of your queries and worse paths for other queries.</p>
<p>&#8220;no/minor impact&#8221;. The blog shows an example where the impact of changing from analyze to dbms_stats() is not minor.  Consistent means &#8220;always does the same thing&#8221;, which means, amongst other things: &#8220;always makes the same mistakes&#8221;.  If, for a given version of Oracle, you always use analyze, the optimizer will always make same mistakes; if you always use dbms_stats() the optimizer will make a different set of mistakes &#8211; but it will always make the same &#8220;different&#8221; set of mistakes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Girish Sharma</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/30/analyze-this/#comment-36459</link>
		<dc:creator><![CDATA[Girish Sharma]]></dc:creator>
		<pubDate>Thu, 10 Jun 2010 03:42:41 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1091#comment-36459</guid>
		<description><![CDATA[You are highlighting that if i change the method of statistic collection; i.e. from analyze command to dbms_stats; now optimizer is having smart and most worth full statistics, but suppose there are two execution plans; (A) With Chain_cnt (B) Without Chain_cnt; so how particular this (chain_cnt) is significantly influence for calculation of index access path?.  Which one is good?  
If i conclude your line &quot;adjustment for the chain_cnt is consistent with the rest of the strategy used by the optimizer..&quot;; so there will no/minor impact of chain_cnt, because it is consistent.  Please correct me, if i am wrong.

Thanks and Regards
Girish Sharma]]></description>
		<content:encoded><![CDATA[<p>You are highlighting that if i change the method of statistic collection; i.e. from analyze command to dbms_stats; now optimizer is having smart and most worth full statistics, but suppose there are two execution plans; (A) With Chain_cnt (B) Without Chain_cnt; so how particular this (chain_cnt) is significantly influence for calculation of index access path?.  Which one is good?<br />
If i conclude your line &#8220;adjustment for the chain_cnt is consistent with the rest of the strategy used by the optimizer..&#8221;; so there will no/minor impact of chain_cnt, because it is consistent.  Please correct me, if i am wrong.</p>
<p>Thanks and Regards<br />
Girish Sharma</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Analyze This &#8211; 2 &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/30/analyze-this/#comment-35973</link>
		<dc:creator><![CDATA[Analyze This &#8211; 2 &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Sat, 03 Apr 2010 10:30:59 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1091#comment-35973</guid>
		<description><![CDATA[[...] I&#8217;ve just rediscovered another note I&#8217;ve written about the difference between dbms_stats and analyze, and the effect this [...]]]></description>
		<content:encoded><![CDATA[<p>[...] I&#8217;ve just rediscovered another note I&#8217;ve written about the difference between dbms_stats and analyze, and the effect this [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/30/analyze-this/#comment-32898</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Tue, 05 May 2009 18:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1091#comment-32898</guid>
		<description><![CDATA[Henry,

There&#039;s certainly a strong case for saying that the adjustment for the &lt;i&gt;&lt;b&gt;chain_cnt&lt;/b&gt;&lt;/i&gt; is consistent with the rest of the strategy used by the optimizer in calculating indexed access paths - and possibly that&#039;s why the code changed in 9i.

The issue I wanted to highlight, though, was that you could get significant changes in costs if you changed your stats collection method.]]></description>
		<content:encoded><![CDATA[<p>Henry,</p>
<p>There&#8217;s certainly a strong case for saying that the adjustment for the <i><b>chain_cnt</b></i> is consistent with the rest of the strategy used by the optimizer in calculating indexed access paths &#8211; and possibly that&#8217;s why the code changed in 9i.</p>
<p>The issue I wanted to highlight, though, was that you could get significant changes in costs if you changed your stats collection method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Henry Poras</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/30/analyze-this/#comment-32893</link>
		<dc:creator><![CDATA[Henry Poras]]></dc:creator>
		<pubDate>Mon, 04 May 2009 19:22:08 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1091#comment-32893</guid>
		<description><![CDATA[
In this case wouldn&#039;t the analyze cost be more accurate as it takes the migrated rows into account?

Henry]]></description>
		<content:encoded><![CDATA[<p>In this case wouldn&#8217;t the analyze cost be more accurate as it takes the migrated rows into account?</p>
<p>Henry</p>
]]></content:encoded>
	</item>
</channel>
</rss>
