<?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/"
		>
<channel>
	<title>Comments on: Scripts for showing execution plans via plain SQL and also in Oracle 9i</title>
	<atom:link href="http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/</link>
	<description>Oracle troubleshooting, internals and performance tuning</description>
	<lastBuildDate>Fri, 30 Jul 2010 06:07:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Sometimes things are easy (Part 1): How to fix wrapped execution plan text? &#124; Tanel Poder's blog: Core IT for Geeks and Pros</title>
		<link>http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/comment-page-1/#comment-3645</link>
		<dc:creator>Sometimes things are easy (Part 1): How to fix wrapped execution plan text? &#124; Tanel Poder's blog: Core IT for Geeks and Pros</dc:creator>
		<pubDate>Mon, 18 Jan 2010 16:26:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/#comment-3645</guid>
		<description>[...] http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-... [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-.." rel="nofollow">http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-..</a>. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Plans gone AWRy &#8211; an invASHtigation &#171; OraStory</title>
		<link>http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/comment-page-1/#comment-3482</link>
		<dc:creator>Plans gone AWRy &#8211; an invASHtigation &#171; OraStory</dc:creator>
		<pubDate>Tue, 29 Dec 2009 16:37:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/#comment-3482</guid>
		<description>[...] If you do hit these display issues then you might prefer to pull your plans from dba_hist_sql_plan for example using a variation of Tanel&#8217;s script here. [...]</description>
		<content:encoded><![CDATA[<p>[...] If you do hit these display issues then you might prefer to pull your plans from dba_hist_sql_plan for example using a variation of Tanel&#8217;s script here. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dakshin</title>
		<link>http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/comment-page-1/#comment-2838</link>
		<dc:creator>Dakshin</dc:creator>
		<pubDate>Wed, 28 Oct 2009 08:25:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/#comment-2838</guid>
		<description>is there a way to get older SQL Plans from history tables? Thanks.</description>
		<content:encoded><![CDATA[<p>is there a way to get older SQL Plans from history tables? Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Log Buffer #148: a Carnival of the Vanities for DBAs &#124; Pythian Group Blog</title>
		<link>http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/comment-page-1/#comment-1693</link>
		<dc:creator>Log Buffer #148: a Carnival of the Vanities for DBAs &#124; Pythian Group Blog</dc:creator>
		<pubDate>Fri, 29 May 2009 16:47:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/#comment-1693</guid>
		<description>[...] Tanel Poder has on offer some scripts for showing execution plans via plain SQL and also in Oracle 9i. [...]</description>
		<content:encoded><![CDATA[<p>[...] Tanel Poder has on offer some scripts for showing execution plans via plain SQL and also in Oracle 9i. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Timur Akhmadeev</title>
		<link>http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/comment-page-1/#comment-1683</link>
		<dc:creator>Timur Akhmadeev</dc:creator>
		<pubDate>Thu, 28 May 2009 07:38:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/#comment-1683</guid>
		<description>Tanel,

I&#039;ve tested a little bit queries against v$sql_plan: pure hierarchical query vs. CSE (with + materialize) and subsequent CONNECT BY. Here are some results:
1) when materialization kicks in everything works perfect (fast, minimum CPU used)
2) CONNECT BY is slower and more  CPU expensive
3) as I was afraid of, materialization (with a query selecting from v$sql_plan) is not happening in some versions. (+) - works, (-) - no:
(+) 9.2.0.8 Linux 64bit with RBO (no stats for SYS schema)
(+) 11.1.0.7 Win XP 32bit
(-) 10.2.0.3 Linux 32bit
(-) 10.2.0.4 Win 2000 32bit
(-) 11.1.0.6 Win 2000 32bit
It means that there still will be problems accessing v$sql_plan using CONNECT BY in some Oracle versions. They may be avoided using additional &quot;self-made&quot; materialization using additional INSERT into previously created table. This will work always as expected.</description>
		<content:encoded><![CDATA[<p>Tanel,</p>
<p>I&#8217;ve tested a little bit queries against v$sql_plan: pure hierarchical query vs. CSE (with + materialize) and subsequent CONNECT BY. Here are some results:<br />
1) when materialization kicks in everything works perfect (fast, minimum CPU used)<br />
2) CONNECT BY is slower and more  CPU expensive<br />
3) as I was afraid of, materialization (with a query selecting from v$sql_plan) is not happening in some versions. (+) &#8211; works, (-) &#8211; no:<br />
(+) 9.2.0.8 Linux 64bit with RBO (no stats for SYS schema)<br />
(+) 11.1.0.7 Win XP 32bit<br />
(-) 10.2.0.3 Linux 32bit<br />
(-) 10.2.0.4 Win 2000 32bit<br />
(-) 11.1.0.6 Win 2000 32bit<br />
It means that there still will be problems accessing v$sql_plan using CONNECT BY in some Oracle versions. They may be avoided using additional &#8220;self-made&#8221; materialization using additional INSERT into previously created table. This will work always as expected.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tanel Poder</title>
		<link>http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/comment-page-1/#comment-1670</link>
		<dc:creator>Tanel Poder</dc:creator>
		<pubDate>Wed, 27 May 2009 13:02:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/#comment-1670</guid>
		<description>The reason why I was thinking about materialize is that if you do that, the connect by will be revisiting in-memory GTT, causing &quot;only&quot; logical IOs. But if you revisit the X$ table you will need to take corresponding library cache latches every time the fixed table rowsource fetches rows from library cache, potentially causing library cache contention and slowing others down.</description>
		<content:encoded><![CDATA[<p>The reason why I was thinking about materialize is that if you do that, the connect by will be revisiting in-memory GTT, causing &#8220;only&#8221; logical IOs. But if you revisit the X$ table you will need to take corresponding library cache latches every time the fixed table rowsource fetches rows from library cache, potentially causing library cache contention and slowing others down.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Timur Akhmadeev</title>
		<link>http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/comment-page-1/#comment-1668</link>
		<dc:creator>Timur Akhmadeev</dc:creator>
		<pubDate>Wed, 27 May 2009 12:52:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/#comment-1668</guid>
		<description>&gt;create in memory GTT
I mean in memory *metadata*</description>
		<content:encoded><![CDATA[<p>&gt;create in memory GTT<br />
I mean in memory *metadata*</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Timur Akhmadeev</title>
		<link>http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/comment-page-1/#comment-1667</link>
		<dc:creator>Timur Akhmadeev</dc:creator>
		<pubDate>Wed, 27 May 2009 12:51:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/#comment-1667</guid>
		<description>Tanel,

Thanks for the information about issues in 9.2.0.6, I have never seen that behavior.

&gt;Regarding the connect by issue, yes the “bug” describes something similar
I would say this is exactly what happens with incrrectly written CONNECT BY, and v$sql_plan is not an exception - something similar is typical for hierarchical queries against complex trees. Yes, data set materialization and subsequent CONNECT BY against it is also a thing to make it work correctly. But MATERIALIZE would require additional work to be done (create in memory GTT, direct path insert plus FTS) + it may not work as expected since MATERIALIZE is undocumented and there are cases when it does not work. I think it should be measured which approach is better, but I prefer straight CONNECT BY.

Regarding feeadback. I have not used scripts yet, and my first impression is based on your example.
1) *Maybe* it&#039;s better to have the same naming conventions for columns as DBMS_XPLAN has (E-Rows, A-Rows, etc.)
2) Your idea about additional information (cursor address, first parsed at + time ago) is quite useful and info sits in right place
3) Placing additional character(s) to identify type of a predicate (F/A) in a plan is brilliant! It is so good that I think it should be moved to DBMS_XPLAN via enhancement request.</description>
		<content:encoded><![CDATA[<p>Tanel,</p>
<p>Thanks for the information about issues in 9.2.0.6, I have never seen that behavior.</p>
<p>&gt;Regarding the connect by issue, yes the “bug” describes something similar<br />
I would say this is exactly what happens with incrrectly written CONNECT BY, and v$sql_plan is not an exception &#8211; something similar is typical for hierarchical queries against complex trees. Yes, data set materialization and subsequent CONNECT BY against it is also a thing to make it work correctly. But MATERIALIZE would require additional work to be done (create in memory GTT, direct path insert plus FTS) + it may not work as expected since MATERIALIZE is undocumented and there are cases when it does not work. I think it should be measured which approach is better, but I prefer straight CONNECT BY.</p>
<p>Regarding feeadback. I have not used scripts yet, and my first impression is based on your example.<br />
1) *Maybe* it&#8217;s better to have the same naming conventions for columns as DBMS_XPLAN has (E-Rows, A-Rows, etc.)<br />
2) Your idea about additional information (cursor address, first parsed at + time ago) is quite useful and info sits in right place<br />
3) Placing additional character(s) to identify type of a predicate (F/A) in a plan is brilliant! It is so good that I think it should be moved to DBMS_XPLAN via enhancement request.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tanel Poder</title>
		<link>http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/comment-page-1/#comment-1666</link>
		<dc:creator>Tanel Poder</dc:creator>
		<pubDate>Wed, 27 May 2009 11:53:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/#comment-1666</guid>
		<description>Regarding the connect by issue, yes the &quot;bug&quot; describes something similar. What needs to be done is that using a WITH subquery (with no_merge and perhaps materialize hint) I would fetch everything relevant to my child cursor only and then run connect by on that. the benefits are that:

a) we fetch data form v$sql_plan once and revisit the fetched data later. that way we don&#039;t need so much library cache latching if we used connect by directly on the v$sql_plan

b) the connect by would have less data to walk through</description>
		<content:encoded><![CDATA[<p>Regarding the connect by issue, yes the &#8220;bug&#8221; describes something similar. What needs to be done is that using a WITH subquery (with no_merge and perhaps materialize hint) I would fetch everything relevant to my child cursor only and then run connect by on that. the benefits are that:</p>
<p>a) we fetch data form v$sql_plan once and revisit the fetched data later. that way we don&#8217;t need so much library cache latching if we used connect by directly on the v$sql_plan</p>
<p>b) the connect by would have less data to walk through</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tanel Poder</title>
		<link>http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/comment-page-1/#comment-1665</link>
		<dc:creator>Tanel Poder</dc:creator>
		<pubDate>Wed, 27 May 2009 11:48:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tanelpoder.com/2009/05/26/scripts-for-showing-execution-plans-via-plain-sql-and-also-in-oracle-9i/#comment-1665</guid>
		<description>Hi Timur,

It&#039;s great to hear that! 

In 9.2 you can use alter session set statistics_level=all (or alter session set &quot;_rowsource_execution_statistics&quot;=true) to get the stats in v$sql_plan_statistics). Note that I&#039;ve seen a problem in 9.2.0.6 where these stats werent populated even after setting the parameters (for cursors opened from PL/SQL I think). The workaroud is to enable sql_trace as well to get v$sql_plan_statistics populated and then you can use xmsh to report it again.

Feel free to give any feedback &amp; improvement requests!</description>
		<content:encoded><![CDATA[<p>Hi Timur,</p>
<p>It&#8217;s great to hear that! </p>
<p>In 9.2 you can use alter session set statistics_level=all (or alter session set &#8220;_rowsource_execution_statistics&#8221;=true) to get the stats in v$sql_plan_statistics). Note that I&#8217;ve seen a problem in 9.2.0.6 where these stats werent populated even after setting the parameters (for cursors opened from PL/SQL I think). The workaroud is to enable sql_trace as well to get v$sql_plan_statistics populated and then you can use xmsh to report it again.</p>
<p>Feel free to give any feedback &#038; improvement requests!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
