<?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: gather_plan_statistics</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Sun, 26 May 2013 02:13:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: gather_plan_statistics &#8211; 2 &#124; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-55810</link>
		<dc:creator><![CDATA[gather_plan_statistics &#8211; 2 &#124; Oracle Scratchpad]]></dc:creator>
		<pubDate>Wed, 22 May 2013 12:40:08 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-55810</guid>
		<description><![CDATA[[&#8230;] time ago &#8211; actually a few years ago &#8211; I wrote a note about the hint /*+ gather_plan_statistics */ making some informal comments about the implementation and relevant hidden parameters. I&#8217;ve [&#8230;]]]></description>
		<content:encoded><![CDATA[<p>[&#8230;] time ago &#8211; actually a few years ago &#8211; I wrote a note about the hint /*+ gather_plan_statistics */ making some informal comments about the implementation and relevant hidden parameters. I&#8217;ve [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cardinality feedback &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-32958</link>
		<dc:creator><![CDATA[Cardinality feedback &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Mon, 11 May 2009 19:32:43 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-32958</guid>
		<description><![CDATA[[...] this point, we could consider running the query again with (say) the /*+&#160;gather_plan_statistics&#160;*/ hint in place, and in another 22 hours or so we would be able to compare estimates with actuals to see [...]]]></description>
		<content:encoded><![CDATA[<p>[...] this point, we could consider running the query again with (say) the /*+&nbsp;gather_plan_statistics&nbsp;*/ hint in place, and in another 22 hours or so we would be able to compare estimates with actuals to see [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Heisenberg &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-31424</link>
		<dc:creator><![CDATA[Heisenberg &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Tue, 01 Jul 2008 07:13:07 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-31424</guid>
		<description><![CDATA[[...] Heisenberg Filed under: Execution plans, Troubleshooting &#8212; Jonathan Lewis @ 9:14 pm UTC Apr 26,2007   [See also: gather plan statistics] [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Heisenberg Filed under: Execution plans, Troubleshooting &#8212; Jonathan Lewis @ 9:14 pm UTC Apr 26,2007   [See also: gather plan statistics] [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-30586</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 19 Mar 2008 10:46:06 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-30586</guid>
		<description><![CDATA[Frank,

Thanks, it&#039;s always useful to have observations like this about new behaviour.]]></description>
		<content:encoded><![CDATA[<p>Frank,</p>
<p>Thanks, it&#8217;s always useful to have observations like this about new behaviour.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank Haney</title>
		<link>http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-30584</link>
		<dc:creator><![CDATA[Frank Haney]]></dc:creator>
		<pubDate>Wed, 19 Mar 2008 08:36:27 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-30584</guid>
		<description><![CDATA[Hi,

I compared read performance of 10g and 11g some weeks ago and found more or less accidentally the discussed behaviour.
An FTS on a big table answered after 3 minutes in 10g but after 1 minute in 11g due to the direct path reads. Executing the statement a second time it anwered after 1 second in 10g because the blocks were cached but again after 1 minute in 11g. At the first glance it seemed to be a strange behaviour if not a bug. But probably it is a feature to avoid flushing buffer cache by large FTSs. 

I performed some tests to influence the behaviour. I tried switching off parallel execution, setting _serial_direct_read=false and changing db_file_multiblock_read_count, without any result. What I&#039;m not tested until now is to change parameters that influence the file IO like filesystemio_option and so on.

Then I changed the size of the table and observed that the turning point is approximately at 10% of the buffer cache. If the table is bigger then a FTS makes direct path read otherwise db file scattered read.

Frank Haney]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I compared read performance of 10g and 11g some weeks ago and found more or less accidentally the discussed behaviour.<br />
An FTS on a big table answered after 3 minutes in 10g but after 1 minute in 11g due to the direct path reads. Executing the statement a second time it anwered after 1 second in 10g because the blocks were cached but again after 1 minute in 11g. At the first glance it seemed to be a strange behaviour if not a bug. But probably it is a feature to avoid flushing buffer cache by large FTSs. </p>
<p>I performed some tests to influence the behaviour. I tried switching off parallel execution, setting _serial_direct_read=false and changing db_file_multiblock_read_count, without any result. What I&#8217;m not tested until now is to change parameters that influence the file IO like filesystemio_option and so on.</p>
<p>Then I changed the size of the table and observed that the turning point is approximately at 10% of the buffer cache. If the table is bigger then a FTS makes direct path read otherwise db file scattered read.</p>
<p>Frank Haney</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-26741</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Fri, 14 Dec 2007 07:54:19 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-26741</guid>
		<description><![CDATA[Jan-Marten,
Oracle has been able to do serial direct reads for a long time (the parameter &lt;b&gt;_serial_direct_read&lt;/b&gt; exists even in 8i) - but 11g may be the first time that the feature is enabled by default (even though the parameter is set to false in 11g).

I haven&#039;t investigated what triggers the choice - but there must be some type of cost-based decision since any direct reads have to start with an object checkpoint to write any dirty blocks for that object back to disc before the read starts.]]></description>
		<content:encoded><![CDATA[<p>Jan-Marten,<br />
Oracle has been able to do serial direct reads for a long time (the parameter <b>_serial_direct_read</b> exists even in 8i) &#8211; but 11g may be the first time that the feature is enabled by default (even though the parameter is set to false in 11g).</p>
<p>I haven&#8217;t investigated what triggers the choice &#8211; but there must be some type of cost-based decision since any direct reads have to start with an object checkpoint to write any dirty blocks for that object back to disc before the read starts.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Val Carey</title>
		<link>http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-26710</link>
		<dc:creator><![CDATA[Val Carey]]></dc:creator>
		<pubDate>Thu, 13 Dec 2007 21:00:37 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-26710</guid>
		<description><![CDATA[Jonathan

I&#039;ve rerun the test again,  more carefully this time,  and the results indicate that you are probably right about the waits being caused by reading from the filesystem although they are not traced.

When I make sure the file is indeed cached in memory by measuring subsequent runs but the first,  cpu and elapsed time are almost the same : 

From V$SQL:

ELAPSED_TIME 59704747
CPU_TIME     59704231
USER_IO_WAIT_TIME 356


When I said that iostat was not showing any read activity,  I was apparently watching the subsequent runs,  not the first one due to an error in my script.  Still,  even with the first run,  the filesystem read waits are not accounted for at all in the trace file and only partially in the V$SQL counters as can be seen in my first message.

Thank you.

Val]]></description>
		<content:encoded><![CDATA[<p>Jonathan</p>
<p>I&#8217;ve rerun the test again,  more carefully this time,  and the results indicate that you are probably right about the waits being caused by reading from the filesystem although they are not traced.</p>
<p>When I make sure the file is indeed cached in memory by measuring subsequent runs but the first,  cpu and elapsed time are almost the same : </p>
<p>From V$SQL:</p>
<p>ELAPSED_TIME 59704747<br />
CPU_TIME     59704231<br />
USER_IO_WAIT_TIME 356</p>
<p>When I said that iostat was not showing any read activity,  I was apparently watching the subsequent runs,  not the first one due to an error in my script.  Still,  even with the first run,  the filesystem read waits are not accounted for at all in the trace file and only partially in the V$SQL counters as can be seen in my first message.</p>
<p>Thank you.</p>
<p>Val</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-26697</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Thu, 13 Dec 2007 17:20:21 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-26697</guid>
		<description><![CDATA[Val,

I just ran a quick test.
No waits of any kind recorded for reading from the filesystem - and there really should have been some, even if they were virtually zero. Just 2 waits for direct path writes, although 10,000 blocks written by direct path.

The former could be indicative of an uninstrumented wait, the latter of a possible cause of highly concurrent CPU usage as the async processes take over the writes.

I was getting close to suggesting that 2Gb at 50Mb/s is roughly the 44 seconds - but that doesn&#039;t match with your comment about iostat :(]]></description>
		<content:encoded><![CDATA[<p>Val,</p>
<p>I just ran a quick test.<br />
No waits of any kind recorded for reading from the filesystem &#8211; and there really should have been some, even if they were virtually zero. Just 2 waits for direct path writes, although 10,000 blocks written by direct path.</p>
<p>The former could be indicative of an uninstrumented wait, the latter of a possible cause of highly concurrent CPU usage as the async processes take over the writes.</p>
<p>I was getting close to suggesting that 2Gb at 50Mb/s is roughly the 44 seconds &#8211; but that doesn&#8217;t match with your comment about iostat :(</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Val Carey</title>
		<link>http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-26692</link>
		<dc:creator><![CDATA[Val Carey]]></dc:creator>
		<pubDate>Thu, 13 Dec 2007 15:29:44 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-26692</guid>
		<description><![CDATA[Jonatahan,

I did look through the raw file,  but except the small number of waits that tkprof already saw,  there was nothing else.  The active session history table snapshots always showed &#039;ON CPU&#039; with no other waits.

The 20 million rows were coming from an external table &#039;p_et&#039; (a flat file 2 GB in size) which explains why there were so few reads. The file itself was most likely heavily cached in memory due to previous runs,  so there was almost no IO judging by iostat. Essentially,  as I understand the insert amounted to moving memory blocks between the OS file cache and SGA (db buffer).

The timeslice preemption is a good idea,  but at the time there was no other process running on the four-cpu 8GB  box,  so it&#039;s unlikely that the 44 seconds can be explained by that.

I encountered quite a few situation like that where I could not explain a similar difference,  but this one is easily reproducible and &#039;clean&#039; in the sense that almost no IO was happening,  no concurrent activity was going on,  and yet substantial time was spent !


Thanks.]]></description>
		<content:encoded><![CDATA[<p>Jonatahan,</p>
<p>I did look through the raw file,  but except the small number of waits that tkprof already saw,  there was nothing else.  The active session history table snapshots always showed &#8216;ON CPU&#8217; with no other waits.</p>
<p>The 20 million rows were coming from an external table &#8216;p_et&#8217; (a flat file 2 GB in size) which explains why there were so few reads. The file itself was most likely heavily cached in memory due to previous runs,  so there was almost no IO judging by iostat. Essentially,  as I understand the insert amounted to moving memory blocks between the OS file cache and SGA (db buffer).</p>
<p>The timeslice preemption is a good idea,  but at the time there was no other process running on the four-cpu 8GB  box,  so it&#8217;s unlikely that the 44 seconds can be explained by that.</p>
<p>I encountered quite a few situation like that where I could not explain a similar difference,  but this one is easily reproducible and &#8216;clean&#8217; in the sense that almost no IO was happening,  no concurrent activity was going on,  and yet substantial time was spent !</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-26676</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Thu, 13 Dec 2007 08:52:16 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/#comment-26676</guid>
		<description><![CDATA[Val,

It&#039;s not possible to make a solid statement about where the lost time went - there may simply be some uninstrmented waits going on.  Have you read through the trace file itself to check for any clues ?

One possibility is your run-state. You have 20,000,000 rows inserted with only 4 direct path writes and 21 single block reads !

Possibly you did a lot more direct I/O (reads for a tablescan, writes for the append) which turned into asynch I/O, which consumed a lot of CPU. Your lost time might be your process being runnable but not running because it had used up its time-slice and the operating system had descheduled it and was allowing the asynch drivers to do their thing.

You could check what&#039;s going on in v$osstat for the OS_CPU_WAIT_TIME while this insert was running. I&#039;m not sure it&#039;s 100% meaningful (see http://jonathanlewis.wordpress.com/2007/11/01/awr-oddity/#comments ) but it may give you a clue.

You could also use something like &#039;top&#039; at the operating system to see where the CPU time is going.]]></description>
		<content:encoded><![CDATA[<p>Val,</p>
<p>It&#8217;s not possible to make a solid statement about where the lost time went &#8211; there may simply be some uninstrmented waits going on.  Have you read through the trace file itself to check for any clues ?</p>
<p>One possibility is your run-state. You have 20,000,000 rows inserted with only 4 direct path writes and 21 single block reads !</p>
<p>Possibly you did a lot more direct I/O (reads for a tablescan, writes for the append) which turned into asynch I/O, which consumed a lot of CPU. Your lost time might be your process being runnable but not running because it had used up its time-slice and the operating system had descheduled it and was allowing the asynch drivers to do their thing.</p>
<p>You could check what&#8217;s going on in v$osstat for the OS_CPU_WAIT_TIME while this insert was running. I&#8217;m not sure it&#8217;s 100% meaningful (see <a href="http://jonathanlewis.wordpress.com/2007/11/01/awr-oddity/#comments" rel="nofollow">http://jonathanlewis.wordpress.com/2007/11/01/awr-oddity/#comments</a> ) but it may give you a clue.</p>
<p>You could also use something like &#8216;top&#8217; at the operating system to see where the CPU time is going.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
