<?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: Time on Stats</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2010/02/20/time-on-stats/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2010/02/20/time-on-stats/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Thu, 23 May 2013 12:47:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2010/02/20/time-on-stats/#comment-35580</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Tue, 23 Feb 2010 09:27:10 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=3156#comment-35580</guid>
		<description><![CDATA[Martin,

Timing can be critical - and performance &quot;tuning&quot; can sometimes be as simple as rescheduling.

Of course, there are times when collecting stats about what the data looked like yesterday just before loading today&#039;s data can lead to odd execution plans in the morning ;)]]></description>
		<content:encoded><![CDATA[<p>Martin,</p>
<p>Timing can be critical &#8211; and performance &#8220;tuning&#8221; can sometimes be as simple as rescheduling.</p>
<p>Of course, there are times when collecting stats about what the data looked like yesterday just before loading today&#8217;s data can lead to odd execution plans in the morning ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2010/02/20/time-on-stats/#comment-35579</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Tue, 23 Feb 2010 09:24:17 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=3156#comment-35579</guid>
		<description><![CDATA[Uwe,

It is certainly necessary to ensure that the statistics you have are a reasonable model of the data - but that doesn&#039;t mean you have to allow the automatic stats collection job to run.

And if you do have the automatic job running, it&#039;s probably a good idea to change the method_opt to avoid collecting histograms - and collecting histograms is (a) the most expensive bit and (b) the bit most liable to be sensitive to change.

My chapter in the &lt;a href=&quot;http://www.amazon.co.uk/Expert-Oracle-Practices-M-Moller/dp/1430226684&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;&lt;strong&gt;second Oak Table compendium&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt; is all about statistics - and end with suggestions about the need (on larger, more complex systems) to devise a simple alternative to the automatic stats collection job.]]></description>
		<content:encoded><![CDATA[<p>Uwe,</p>
<p>It is certainly necessary to ensure that the statistics you have are a reasonable model of the data &#8211; but that doesn&#8217;t mean you have to allow the automatic stats collection job to run.</p>
<p>And if you do have the automatic job running, it&#8217;s probably a good idea to change the method_opt to avoid collecting histograms &#8211; and collecting histograms is (a) the most expensive bit and (b) the bit most liable to be sensitive to change.</p>
<p>My chapter in the <a href="http://www.amazon.co.uk/Expert-Oracle-Practices-M-Moller/dp/1430226684" rel="nofollow"><em><strong>second Oak Table compendium</strong></em></a> is all about statistics &#8211; and end with suggestions about the need (on larger, more complex systems) to devise a simple alternative to the automatic stats collection job.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mwidlake</title>
		<link>http://jonathanlewis.wordpress.com/2010/02/20/time-on-stats/#comment-35575</link>
		<dc:creator><![CDATA[mwidlake]]></dc:creator>
		<pubDate>Mon, 22 Feb 2010 18:07:40 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=3156#comment-35575</guid>
		<description><![CDATA[Hi Uwe,

A problem I have seen a couple of times and that I know others have, is that the default stats gathering window falls at the same time as the batch process window for many systems. A lot of Data warehouses have their busiest processing time preparing data overnight, in time for the users to look at it in the morning. Changing the schedular window to the ealry evening, so the stats gathering usually finishes before midnight can help.

An another alternative, which is very manual and a bit dirty, is you check for very large objects that have reached 8 or 9% changed and do a manual gather on the table and it&#039;s indexes before the auto job picks it up. You can pick low values and parallel processing to get it done quickly. I did that &quot;by hand&quot; for a few weeks once :-)]]></description>
		<content:encoded><![CDATA[<p>Hi Uwe,</p>
<p>A problem I have seen a couple of times and that I know others have, is that the default stats gathering window falls at the same time as the batch process window for many systems. A lot of Data warehouses have their busiest processing time preparing data overnight, in time for the users to look at it in the morning. Changing the schedular window to the ealry evening, so the stats gathering usually finishes before midnight can help.</p>
<p>An another alternative, which is very manual and a bit dirty, is you check for very large objects that have reached 8 or 9% changed and do a manual gather on the table and it&#8217;s indexes before the auto job picks it up. You can pick low values and parallel processing to get it done quickly. I did that &#8220;by hand&#8221; for a few weeks once :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Uwe Hesse</title>
		<link>http://jonathanlewis.wordpress.com/2010/02/20/time-on-stats/#comment-35574</link>
		<dc:creator><![CDATA[Uwe Hesse]]></dc:creator>
		<pubDate>Mon, 22 Feb 2010 17:38:44 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=3156#comment-35574</guid>
		<description><![CDATA[Although it is true that gathering statistics cause a (varying, depending on the amount of change of the analyzed tables) load on the database, there is no sensible alternative, or is there? 
All we can do is to determine, whether there is a critical task done in the time window where the statistic gathering job is running - and then modify that time window accordingly. That has got easier in 11g, where we have a different scheduler window used to determine the statistics gathering task for each weekday.]]></description>
		<content:encoded><![CDATA[<p>Although it is true that gathering statistics cause a (varying, depending on the amount of change of the analyzed tables) load on the database, there is no sensible alternative, or is there?<br />
All we can do is to determine, whether there is a critical task done in the time window where the statistic gathering job is running &#8211; and then modify that time window accordingly. That has got easier in 11g, where we have a different scheduler window used to determine the statistics gathering task for each weekday.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2010/02/20/time-on-stats/#comment-35572</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Mon, 22 Feb 2010 14:43:19 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=3156#comment-35572</guid>
		<description><![CDATA[David,

I supplied the predicate: 


&lt;blockquote&gt; &lt;em&gt;job_name = &#039;GATHER_STATS_JOB&#039;&lt;/em&gt;&lt;/blockquote&gt;


The view definition for column job_name is: 


&lt;blockquote&gt; &lt;em&gt;DECODE(INSTR(“E”.”NAME”,’”‘),0,”E”.”NAME”,SUBSTR(“E”.”NAME”,1,INSTR(“E”.”NAME”,’”‘)-1))&lt;/em&gt;&lt;/blockquote&gt;



One day the optimizer may be able to handle the type of inference that you are suggesting - but it can&#039;t do so at present.]]></description>
		<content:encoded><![CDATA[<p>David,</p>
<p>I supplied the predicate: </p>
<blockquote><p> <em>job_name = &#8216;GATHER_STATS_JOB&#8217;</em></p></blockquote>
<p>The view definition for column job_name is: </p>
<blockquote><p> <em>DECODE(INSTR(“E”.”NAME”,’”‘),0,”E”.”NAME”,SUBSTR(“E”.”NAME”,1,INSTR(“E”.”NAME”,’”‘)-1))</em></p></blockquote>
<p>One day the optimizer may be able to handle the type of inference that you are suggesting &#8211; but it can&#8217;t do so at present.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Aldridge</title>
		<link>http://jonathanlewis.wordpress.com/2010/02/20/time-on-stats/#comment-35570</link>
		<dc:creator><![CDATA[David Aldridge]]></dc:creator>
		<pubDate>Mon, 22 Feb 2010 07:31:26 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=3156#comment-35570</guid>
		<description><![CDATA[That&#039;s an interesting predicate:

DECODE(INSTR(&quot;E&quot;.&quot;NAME&quot;,&#039;&quot;&#039;),0,&quot;E&quot;.&quot;NAME&quot;,SUBSTR(&quot;E&quot;.&quot;NAME&quot;,1,INSTR(&quot;E&quot;.&quot;NAME&quot;,&#039;&quot;&#039;)-1))=&#039;GATHER_STATS_JOB&#039;

I wonder why it is not written as: &quot;E&quot;.&quot;NAME&quot; LIKE &#039;GATHER_STATS_JOB%&#039;

Not strictly the same, but at least an index wouldn&#039;t have to be function-based to be useful.]]></description>
		<content:encoded><![CDATA[<p>That&#8217;s an interesting predicate:</p>
<p>DECODE(INSTR(&#8220;E&#8221;.&#8221;NAME&#8221;,&#8217;&#8221;&#8216;),0,&#8221;E&#8221;.&#8221;NAME&#8221;,SUBSTR(&#8220;E&#8221;.&#8221;NAME&#8221;,1,INSTR(&#8220;E&#8221;.&#8221;NAME&#8221;,&#8217;&#8221;&#8216;)-1))=&#8217;GATHER_STATS_JOB&#8217;</p>
<p>I wonder why it is not written as: &#8220;E&#8221;.&#8221;NAME&#8221; LIKE &#8216;GATHER_STATS_JOB%&#8217;</p>
<p>Not strictly the same, but at least an index wouldn&#8217;t have to be function-based to be useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vineeth Kalanthodi</title>
		<link>http://jonathanlewis.wordpress.com/2010/02/20/time-on-stats/#comment-35562</link>
		<dc:creator><![CDATA[Vineeth Kalanthodi]]></dc:creator>
		<pubDate>Sun, 21 Feb 2010 11:27:12 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=3156#comment-35562</guid>
		<description><![CDATA[Hi Jonathan,

I had a related problem last week, gather_schema_stats job running two days in my sqlplus session(oracle version 10.2.0.4), it was a request from client to collect stats for a schema at 10am on Monday morning, as they loaded 8m rows into a table which already got 10m rows, so to become 18m rows. Table is not partitioned.

From dba_scheduler_job_run_details automatic stats collection job status was ‘STOPPED’ for Monday and Tuesday night runs, as weekday window is from 22pm to 6am. 

Wednesday afternoon i cancelled my sqlplus session, I was using gather_schema_stats with estimate_percent as auto sample size, method_opt_column size also auto. Then I tried the same with degree set to 7, server got 8 physical cpu’s, still no luck, it was taking hrs, there is problem sql reported in metalink for running gather_schema_stats with auto options, and I found same sql in my awr report. 

finally I tried with sample size 1 and column size 1 (without histograms) in sqlplus, job finished within few minutes, and automatic stats collection job was successful from that night onwards. I didn’t change any auto option values using SET_PARAM procedure.

Regards,
Vineeth]]></description>
		<content:encoded><![CDATA[<p>Hi Jonathan,</p>
<p>I had a related problem last week, gather_schema_stats job running two days in my sqlplus session(oracle version 10.2.0.4), it was a request from client to collect stats for a schema at 10am on Monday morning, as they loaded 8m rows into a table which already got 10m rows, so to become 18m rows. Table is not partitioned.</p>
<p>From dba_scheduler_job_run_details automatic stats collection job status was ‘STOPPED’ for Monday and Tuesday night runs, as weekday window is from 22pm to 6am. </p>
<p>Wednesday afternoon i cancelled my sqlplus session, I was using gather_schema_stats with estimate_percent as auto sample size, method_opt_column size also auto. Then I tried the same with degree set to 7, server got 8 physical cpu’s, still no luck, it was taking hrs, there is problem sql reported in metalink for running gather_schema_stats with auto options, and I found same sql in my awr report. </p>
<p>finally I tried with sample size 1 and column size 1 (without histograms) in sqlplus, job finished within few minutes, and automatic stats collection job was successful from that night onwards. I didn’t change any auto option values using SET_PARAM procedure.</p>
<p>Regards,<br />
Vineeth</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2010/02/20/time-on-stats/#comment-35552</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Sat, 20 Feb 2010 20:33:45 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=3156#comment-35552</guid>
		<description><![CDATA[Martin,
Good idea, thanks for that.
Something like:
[sourcecode]
select 
	operation, 
	start_time, 
	end_time - start_time
from 
	dba_optstat_operations
where
	operation = &#039;gather_database_stats(auto)&#039;
order by 
	start_time desc
;sourcecode]

[/sourcecode]
(Formatting left as exercise).

The only drawback is that this doesn&#039;t give you a success/fail indicator - which the scheduler does.

I&#039;ve seen a similar, but possibly funnier, example of your &quot;stuck&quot; statistics.  Big batch load to enormous table causes Oracle to fail to collect stats every night for a week - finally succeeding on the big table at 8:00 pm Sunday night ... just in time for the table to be dump and reloaded.

I see that you&#039;ve got &lt;a href=&quot;http://mwidlake.wordpress.com/2009/07/20/automated-statistics-gathering-silently-fails/&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;&lt;strong&gt;a mini-series on your blog&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt; about stats collection silently failing.]]></description>
		<content:encoded><![CDATA[<p>Martin,<br />
Good idea, thanks for that.<br />
Something like:</p>
<pre class="brush: plain; title: ; notranslate">
select 
	operation, 
	start_time, 
	end_time - start_time
from 
	dba_optstat_operations
where
	operation = 'gather_database_stats(auto)'
order by 
	start_time desc
;sourcecode]

</pre>
<p>(Formatting left as exercise).</p>
<p>The only drawback is that this doesn&#8217;t give you a success/fail indicator &#8211; which the scheduler does.</p>
<p>I&#8217;ve seen a similar, but possibly funnier, example of your &#8220;stuck&#8221; statistics.  Big batch load to enormous table causes Oracle to fail to collect stats every night for a week &#8211; finally succeeding on the big table at 8:00 pm Sunday night &#8230; just in time for the table to be dump and reloaded.</p>
<p>I see that you&#8217;ve got <a href="http://mwidlake.wordpress.com/2009/07/20/automated-statistics-gathering-silently-fails/" rel="nofollow"><em><strong>a mini-series on your blog</strong></em></a> about stats collection silently failing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mwidlake</title>
		<link>http://jonathanlewis.wordpress.com/2010/02/20/time-on-stats/#comment-35551</link>
		<dc:creator><![CDATA[mwidlake]]></dc:creator>
		<pubDate>Sat, 20 Feb 2010 19:40:25 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=3156#comment-35551</guid>
		<description><![CDATA[Hi Jonathan,

If you only want to know about the automatic stats collection job running, you can look at DBA_OPTSTAT_OPERATIONS, which itself looks at sys.WRI$_OPTSTAT_OPR. There is no index on this underlying table, but as it only hold information about statistic gathering operations that covered schemas, system, dictionary or everything (the automatic stats job) it contains relatively few records.

If you have a system with very large tables (hundreds of GB or even TB) it is very important to check how long the automatic stats job ran for. Under V10 at least, it can get &quot;stuck&quot;. It spends so long gathering stats on the very large table or tables that it never finishes, then tries to gather stats on the same table(s) the next night and fails again... and again...until the weekend when it gets more time to run.

If things get really bad, it will fail over the weekend too and, in effect, your automatic stats gathering stops. You are not warned about this by the system, you have to go and check!

Martin]]></description>
		<content:encoded><![CDATA[<p>Hi Jonathan,</p>
<p>If you only want to know about the automatic stats collection job running, you can look at DBA_OPTSTAT_OPERATIONS, which itself looks at sys.WRI$_OPTSTAT_OPR. There is no index on this underlying table, but as it only hold information about statistic gathering operations that covered schemas, system, dictionary or everything (the automatic stats job) it contains relatively few records.</p>
<p>If you have a system with very large tables (hundreds of GB or even TB) it is very important to check how long the automatic stats job ran for. Under V10 at least, it can get &#8220;stuck&#8221;. It spends so long gathering stats on the very large table or tables that it never finishes, then tries to gather stats on the same table(s) the next night and fails again&#8230; and again&#8230;until the weekend when it gets more time to run.</p>
<p>If things get really bad, it will fail over the weekend too and, in effect, your automatic stats gathering stops. You are not warned about this by the system, you have to go and check!</p>
<p>Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simple scripts &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2010/02/20/time-on-stats/#comment-35547</link>
		<dc:creator><![CDATA[Simple scripts &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Sat, 20 Feb 2010 18:38:35 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=3156#comment-35547</guid>
		<description><![CDATA[[...] Time on&#160;Stats  [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Time on&nbsp;Stats  [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
