<?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: Plans in Memory</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2006/12/12/plans-in-memory/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2006/12/12/plans-in-memory/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Wed, 22 May 2013 01:50:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Amardeep Sidhu</title>
		<link>http://jonathanlewis.wordpress.com/2006/12/12/plans-in-memory/#comment-36919</link>
		<dc:creator><![CDATA[Amardeep Sidhu]]></dc:creator>
		<pubDate>Thu, 05 Aug 2010 07:27:39 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=90#comment-36919</guid>
		<description><![CDATA[Jonathan,

Thanks for the insight.

Looking forward to your session at AIOUG, Hyderabad :)]]></description>
		<content:encoded><![CDATA[<p>Jonathan,</p>
<p>Thanks for the insight.</p>
<p>Looking forward to your session at AIOUG, Hyderabad :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2006/12/12/plans-in-memory/#comment-36834</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Sat, 24 Jul 2010 10:04:52 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=90#comment-36834</guid>
		<description><![CDATA[If you can&#039;t find a way of getting the same plan, the simplest thing is to get the test run repeated, and monitor the session until it executes the query, then pull the plan from memory. This will still leave a gap because the in-memory plans won&#039;t record predicates that include subquerier properly, but it should help you get a lot closer to the full detail.

If you can&#039;t do this live, then generating the trace at level 4 will give you the bind variable values and &lt;b&gt;types&lt;/b&gt;, which may help you to fake the plan.  Note that you may have to change the code so that all references to bind variables have explicit conversion functions applied. You may end up having to hint the SQL to force the plan.  

Inevitably there will be cases where it is extremely difficult to get &quot;explain plan&quot; to reproduce exactly the same path (down to the predicate level) even if you put in hints that make the plan look the same. But since it&#039;s usually the statistics or the variable types that make the differences, you can often fiddle around and get a pretty good idea.

If you&#039;ve got a closed cursor from your tkprof output, you&#039;ll have the row counts returned as well - which gives you extra information about which execution lines  did most work, and that&#039;s important information that you can use to confirm your suspicions.]]></description>
		<content:encoded><![CDATA[<p>If you can&#8217;t find a way of getting the same plan, the simplest thing is to get the test run repeated, and monitor the session until it executes the query, then pull the plan from memory. This will still leave a gap because the in-memory plans won&#8217;t record predicates that include subquerier properly, but it should help you get a lot closer to the full detail.</p>
<p>If you can&#8217;t do this live, then generating the trace at level 4 will give you the bind variable values and <b>types</b>, which may help you to fake the plan.  Note that you may have to change the code so that all references to bind variables have explicit conversion functions applied. You may end up having to hint the SQL to force the plan.  </p>
<p>Inevitably there will be cases where it is extremely difficult to get &#8220;explain plan&#8221; to reproduce exactly the same path (down to the predicate level) even if you put in hints that make the plan look the same. But since it&#8217;s usually the statistics or the variable types that make the differences, you can often fiddle around and get a pretty good idea.</p>
<p>If you&#8217;ve got a closed cursor from your tkprof output, you&#8217;ll have the row counts returned as well &#8211; which gives you extra information about which execution lines  did most work, and that&#8217;s important information that you can use to confirm your suspicions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amardeep Sidhu</title>
		<link>http://jonathanlewis.wordpress.com/2006/12/12/plans-in-memory/#comment-36793</link>
		<dc:creator><![CDATA[Amardeep Sidhu]]></dc:creator>
		<pubDate>Wed, 21 Jul 2010 17:54:09 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=90#comment-36793</guid>
		<description><![CDATA[Hi Jonathan,

My question is bit different from the content in the post.

While reading an explain plan output i find predicate information very useful for checking the columns on which access &amp; filter operations are happening. But in the execution plan printed in the tkprof output there is no predicate information. How do we make up for this missing piece of information, if we are given a tkprof output to analyze ?

What i generally try to do is that take explain plan of the query and see the predicate stuff from there. But in many of the cases the execution plan in the tkprof (actual execution plan) &amp; the plan given by explain plan differ. Would like to know that how to troubleshoot the expensive steps in the execution plan in such cases ?

Thanks !

Regards,
Amardeep Sidhu]]></description>
		<content:encoded><![CDATA[<p>Hi Jonathan,</p>
<p>My question is bit different from the content in the post.</p>
<p>While reading an explain plan output i find predicate information very useful for checking the columns on which access &amp; filter operations are happening. But in the execution plan printed in the tkprof output there is no predicate information. How do we make up for this missing piece of information, if we are given a tkprof output to analyze ?</p>
<p>What i generally try to do is that take explain plan of the query and see the predicate stuff from there. But in many of the cases the execution plan in the tkprof (actual execution plan) &amp; the plan given by explain plan differ. Would like to know that how to troubleshoot the expensive steps in the execution plan in such cases ?</p>
<p>Thanks !</p>
<p>Regards,<br />
Amardeep Sidhu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Show Me a Picture! &#171; So Many Oracle Manuals, So Little Time</title>
		<link>http://jonathanlewis.wordpress.com/2006/12/12/plans-in-memory/#comment-33004</link>
		<dc:creator><![CDATA[Show Me a Picture! &#171; So Many Oracle Manuals, So Little Time]]></dc:creator>
		<pubDate>Fri, 15 May 2009 05:48:51 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=90#comment-33004</guid>
		<description><![CDATA[[...] download the PL/SQL package and the SQL query mentioned in the article. I got this idea from a comment left on Jonathan Lewis’ blog. The SQL query generates Graphviz commands that produce a [...]]]></description>
		<content:encoded><![CDATA[<p>[...] download the PL/SQL package and the SQL query mentioned in the article. I got this idea from a comment left on Jonathan Lewis’ blog. The SQL query generates Graphviz commands that produce a [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Helm</title>
		<link>http://jonathanlewis.wordpress.com/2006/12/12/plans-in-memory/#comment-608</link>
		<dc:creator><![CDATA[Andy Helm]]></dc:creator>
		<pubDate>Tue, 19 Dec 2006 14:21:28 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=90#comment-608</guid>
		<description><![CDATA[OK, to show your predicates, access first then filter, ordered by plan step id:

select id,acc_or_fil,predicates
  from (
 select id,&#039;access&#039; acc_or_fil ,access_predicates predicates
   from plan_table
  where access_predicates is not null
 union all
 select id,&#039;filter&#039;,filter_predicates
   from plan_table
  where filter_predicates is not null
) order by 1,2
/]]></description>
		<content:encoded><![CDATA[<p>OK, to show your predicates, access first then filter, ordered by plan step id:</p>
<p>select id,acc_or_fil,predicates<br />
  from (<br />
 select id,&#8217;access&#8217; acc_or_fil ,access_predicates predicates<br />
   from plan_table<br />
  where access_predicates is not null<br />
 union all<br />
 select id,&#8217;filter&#8217;,filter_predicates<br />
   from plan_table<br />
  where filter_predicates is not null<br />
) order by 1,2<br />
/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian</title>
		<link>http://jonathanlewis.wordpress.com/2006/12/12/plans-in-memory/#comment-600</link>
		<dc:creator><![CDATA[Ian]]></dc:creator>
		<pubDate>Tue, 19 Dec 2006 11:44:06 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=90#comment-600</guid>
		<description><![CDATA[Jonathan, Thanks for the info on the hints. Much appreciated.

Nice Blog BTW.

Regards

Ian]]></description>
		<content:encoded><![CDATA[<p>Jonathan, Thanks for the info on the hints. Much appreciated.</p>
<p>Nice Blog BTW.</p>
<p>Regards</p>
<p>Ian</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2006/12/12/plans-in-memory/#comment-578</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Mon, 18 Dec 2006 21:12:27 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=90#comment-578</guid>
		<description><![CDATA[Ian, I&#039;ve just rediscovered the reference on Metalink about cardinality and selectivity in 10g.  It&#039;s bug number: 4121077 - SELECTIVITY HINT NOT WORKING IN 10G BUT WORKING IN 9206.

Highlights are:
&lt;em&gt;There is no SELECTIVITY hint in 10g.   
There is a CARDINALITY hint in 10g and 9.2&lt;/em&gt;

&lt;em&gt;As the SELECTIVITY hint is not a documented item there is no bug here but you can use the undocumented CARDINALITY hint instead, but it too may be obsoleted in future.&lt;/em&gt;]]></description>
		<content:encoded><![CDATA[<p>Ian, I&#8217;ve just rediscovered the reference on Metalink about cardinality and selectivity in 10g.  It&#8217;s bug number: 4121077 &#8211; SELECTIVITY HINT NOT WORKING IN 10G BUT WORKING IN 9206.</p>
<p>Highlights are:<br />
<em>There is no SELECTIVITY hint in 10g.<br />
There is a CARDINALITY hint in 10g and 9.2</em></p>
<p><em>As the SELECTIVITY hint is not a documented item there is no bug here but you can use the undocumented CARDINALITY hint instead, but it too may be obsoleted in future.</em></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: winden</title>
		<link>http://jonathanlewis.wordpress.com/2006/12/12/plans-in-memory/#comment-523</link>
		<dc:creator><![CDATA[winden]]></dc:creator>
		<pubDate>Sat, 16 Dec 2006 18:02:56 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=90#comment-523</guid>
		<description><![CDATA[I&#039;ve used sometimes this script on OSX to have graphical display of the query (10g tested, I dont remember if I had coded this when testing the 9i prerelease...). You need graphviz instaled so that the .dot file is loaded and displayed ok... and it sure helps a lot to visualize computations that way :)


set heading  off
set pagesize 0


delete from plan_table;
explain plan for
select * from drawscan10; /* yeah */


set linesize 3000
spool plan.dot


select &#039;digraph a {&#039; from dual union all
select op from(
select pid, prior op&#124;&#124;&#039;-&gt;&#039;&#124;&#124;op&#124;&#124;&#039;;&#039; op
  from (
select id, parent_id pid,
       &#039;&quot;&#039;&#124;&#124;id&#124;&#124;
       &#039; &#039;&#124;&#124;operation&#124;&#124;
       &#039;\n&#039;&#124;&#124;options&#124;&#124;
       &#039;\n&#039;&#124;&#124;object_name&#124;&#124;&#039; (&#039;&#124;&#124;cardinality&#124;&#124;&#039;)&#039;&#124;&#124;
       &#039;\nACCESS: &#039;&#124;&#124;replace(replace(access_predicates,&#039;&quot;&#039;,&#039;&#039;),&#039;AND&#039;,&#039;\nAND&#039;)&#124;&#124;
       &#039;\nFILTER: &#039;&#124;&#124;replace(replace(filter_predicates,&#039;&quot;&#039;,&#039;&#039;),&#039;AND&#039;,&#039;\nAND&#039;)&#124;&#124;
       &#039;&quot;&#039; op
  from plan_table
       )
 start with pid is null
 connect by pid = prior id
) where pid is not null
union all
select &#039;};&#039; from dual;


spool off


spool plan.txt
select * from table(dbms_xplan.display);
spool off


set heading on
set pagesize 20


host open plan.dot


set linesize 90]]></description>
		<content:encoded><![CDATA[<p>I&#8217;ve used sometimes this script on OSX to have graphical display of the query (10g tested, I dont remember if I had coded this when testing the 9i prerelease&#8230;). You need graphviz instaled so that the .dot file is loaded and displayed ok&#8230; and it sure helps a lot to visualize computations that way :)</p>
<p>set heading  off<br />
set pagesize 0</p>
<p>delete from plan_table;<br />
explain plan for<br />
select * from drawscan10; /* yeah */</p>
<p>set linesize 3000<br />
spool plan.dot</p>
<p>select &#8216;digraph a {&#8216; from dual union all<br />
select op from(<br />
select pid, prior op||&#8217;-&gt;&#8217;||op||&#8217;;&#8217; op<br />
  from (<br />
select id, parent_id pid,<br />
       &#8216;&#8221;&#8216;||id||<br />
       &#8216; &#8216;||operation||<br />
       &#8216;\n&#8217;||options||<br />
       &#8216;\n&#8217;||object_name||&#8217; (&#8216;||cardinality||&#8217;)'||<br />
       &#8216;\nACCESS: &#8216;||replace(replace(access_predicates,&#8217;&#8221;&#8216;,&#8221;),&#8217;AND&#8217;,'\nAND&#8217;)||<br />
       &#8216;\nFILTER: &#8216;||replace(replace(filter_predicates,&#8217;&#8221;&#8216;,&#8221;),&#8217;AND&#8217;,'\nAND&#8217;)||<br />
       &#8216;&#8221;&#8216; op<br />
  from plan_table<br />
       )<br />
 start with pid is null<br />
 connect by pid = prior id<br />
) where pid is not null<br />
union all<br />
select &#8216;};&#8217; from dual;</p>
<p>spool off</p>
<p>spool plan.txt<br />
select * from table(dbms_xplan.display);<br />
spool off</p>
<p>set heading on<br />
set pagesize 20</p>
<p>host open plan.dot</p>
<p>set linesize 90</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2006/12/12/plans-in-memory/#comment-451</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Thu, 14 Dec 2006 20:31:42 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=90#comment-451</guid>
		<description><![CDATA[Dave, take a look at &lt;a href=&quot;http://jonathanlewis.wordpress.com/2006/11/09/dbms_xplan-in-10g/&quot; rel=&quot;nofollow&quot;&gt;the article on dbms_xplan.display_cursor&lt;/a&gt; referenced above; it mentions the benefit of the data you can get from &lt;b&gt;v$sql_plan_statistics&lt;/b&gt;, but for 9i you don&#039;t have a convenient hint to enable collection. Instead, you can execute:
&lt;em&gt;alter session set statistics_level = all;&lt;/em&gt;
or
&lt;em&gt;alter session set &quot;_rowsource_execution_statistics&quot;=true;&lt;/em&gt;
before executing a query.]]></description>
		<content:encoded><![CDATA[<p>Dave, take a look at <a href="http://jonathanlewis.wordpress.com/2006/11/09/dbms_xplan-in-10g/" rel="nofollow">the article on dbms_xplan.display_cursor</a> referenced above; it mentions the benefit of the data you can get from <b>v$sql_plan_statistics</b>, but for 9i you don&#8217;t have a convenient hint to enable collection. Instead, you can execute:<br />
<em>alter session set statistics_level = all;</em><br />
or<br />
<em>alter session set &#8220;_rowsource_execution_statistics&#8221;=true;</em><br />
before executing a query.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2006/12/12/plans-in-memory/#comment-450</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Thu, 14 Dec 2006 20:13:07 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=90#comment-450</guid>
		<description><![CDATA[Ian, Finding such things - I use use &quot;strings -a&quot; on the Oracle executable for Unix and search for any interesting text. Looking for &quot;star_transformation&quot; was a good way of finding the list of possible hints. This is no longer so simple in 10g as the hints are now just words in the reserved words list.

Materialize and Cardinality I first saw (I think) in SQL dumped from the executable and then I searched Metalink although I&#039;m sure I found cardinality somewhere in the documentation once.  

&lt;b&gt;Materialize&lt;/b&gt; is actually given as a workaround to a bug (3528916.8). So it is semi-official.

I can&#039;t find the original documentation reference I had for the &lt;b&gt;cardinality&lt;/b&gt; hint (which was incomplete anyway) - but it arrived in 9i and there was a document somewhere on metalink which says something about its existence and the disappearance of the &lt;b&gt;selectivity&lt;/b&gt; hint in 10g.]]></description>
		<content:encoded><![CDATA[<p>Ian, Finding such things &#8211; I use use &#8220;strings -a&#8221; on the Oracle executable for Unix and search for any interesting text. Looking for &#8220;star_transformation&#8221; was a good way of finding the list of possible hints. This is no longer so simple in 10g as the hints are now just words in the reserved words list.</p>
<p>Materialize and Cardinality I first saw (I think) in SQL dumped from the executable and then I searched Metalink although I&#8217;m sure I found cardinality somewhere in the documentation once.  </p>
<p><b>Materialize</b> is actually given as a workaround to a bug (3528916.8). So it is semi-official.</p>
<p>I can&#8217;t find the original documentation reference I had for the <b>cardinality</b> hint (which was incomplete anyway) &#8211; but it arrived in 9i and there was a document somewhere on metalink which says something about its existence and the disappearance of the <b>selectivity</b> hint in 10g.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
