<?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: EXPLAIN PLAN shared memory</title>
	<atom:link href="http://timurakhmadeev.wordpress.com/2011/11/24/explain-plan-shared-memory/feed/" rel="self" type="application/rss+xml" />
	<link>http://timurakhmadeev.wordpress.com/2011/11/24/explain-plan-shared-memory/</link>
	<description></description>
	<lastBuildDate>Thu, 02 May 2013 19:03:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Timur Akhmadeev</title>
		<link>http://timurakhmadeev.wordpress.com/2011/11/24/explain-plan-shared-memory/#comment-1662</link>
		<dc:creator><![CDATA[Timur Akhmadeev]]></dc:creator>
		<pubDate>Thu, 17 Jan 2013 03:26:40 +0000</pubDate>
		<guid isPermaLink="false">http://timurakhmadeev.wordpress.com/?p=734#comment-1662</guid>
		<description><![CDATA[That is wrong, I checked memory of the last executed statement which is not what&#039;s needed. Here&#039;s the right version &amp; output:
[sourcecode lang=&quot;sql&quot;]
set serveroutput off
col uq_id new_value uq_id
select to_char(sysdate, &#039;YYYYMMDDHH24MISS&#039;) uq_id from dual;

select /*+ &amp;uq_id */ count(*) from dual;

select sharable_mem, typecheck_mem
  from v$sql 
 where sql_id = (select s.prev_sql_id from v$session s where sid = userenv(&#039;sid&#039;))
   and child_number = (select s.prev_child_number from v$session s where sid = userenv(&#039;sid&#039;));

explain plan for select /*+ &amp;uq_id */ count(*) from dual;

col prev_sql_id new_value sql_id
col prev_child_number new_value child_number

select s.prev_sql_id, prev_child_number from v$session s where sid = userenv(&#039;sid&#039;);

select sharable_mem, typecheck_mem
  from v$sql 
 where sql_id = &#039;&amp;sql_id&#039;
   and child_number = &amp;child_number;
[/sourcecode]
[sourcecode]
SQL&gt; @tc\xplan_shared_mem

UQ_ID
--------------
20130117072128


            COUNT(*)
--------------------
                   1


        SHARABLE_MEM        TYPECHECK_MEM
-------------------- --------------------
               15624                    0


Explained.


PREV_SQL_ID      PREV_CHILD_NUMBER
------------- --------------------
65mhg515qht3d                    0


        SHARABLE_MEM        TYPECHECK_MEM
-------------------- --------------------
               36905                96600

SQL&gt; /

        SHARABLE_MEM        TYPECHECK_MEM
-------------------- --------------------
               36905                96600

SQL&gt; /

        SHARABLE_MEM        TYPECHECK_MEM
-------------------- --------------------
               36905                96600
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>That is wrong, I checked memory of the last executed statement which is not what&#8217;s needed. Here&#8217;s the right version &amp; output:</p>
<pre class="brush: sql; title: ; notranslate">
set serveroutput off
col uq_id new_value uq_id
select to_char(sysdate, 'YYYYMMDDHH24MISS') uq_id from dual;

select /*+ &amp;uq_id */ count(*) from dual;

select sharable_mem, typecheck_mem
  from v$sql 
 where sql_id = (select s.prev_sql_id from v$session s where sid = userenv('sid'))
   and child_number = (select s.prev_child_number from v$session s where sid = userenv('sid'));

explain plan for select /*+ &amp;uq_id */ count(*) from dual;

col prev_sql_id new_value sql_id
col prev_child_number new_value child_number

select s.prev_sql_id, prev_child_number from v$session s where sid = userenv('sid');

select sharable_mem, typecheck_mem
  from v$sql 
 where sql_id = '&amp;sql_id'
   and child_number = &amp;child_number;
</pre>
<pre class="brush: plain; title: ; notranslate">
SQL&gt; @tc\xplan_shared_mem

UQ_ID
--------------
20130117072128


            COUNT(*)
--------------------
                   1


        SHARABLE_MEM        TYPECHECK_MEM
-------------------- --------------------
               15624                    0


Explained.


PREV_SQL_ID      PREV_CHILD_NUMBER
------------- --------------------
65mhg515qht3d                    0


        SHARABLE_MEM        TYPECHECK_MEM
-------------------- --------------------
               36905                96600

SQL&gt; /

        SHARABLE_MEM        TYPECHECK_MEM
-------------------- --------------------
               36905                96600

SQL&gt; /

        SHARABLE_MEM        TYPECHECK_MEM
-------------------- --------------------
               36905                96600
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Timur Akhmadeev</title>
		<link>http://timurakhmadeev.wordpress.com/2011/11/24/explain-plan-shared-memory/#comment-1661</link>
		<dc:creator><![CDATA[Timur Akhmadeev]]></dc:creator>
		<pubDate>Thu, 17 Jan 2013 03:06:18 +0000</pubDate>
		<guid isPermaLink="false">http://timurakhmadeev.wordpress.com/?p=734#comment-1661</guid>
		<description><![CDATA[Hi Tanel,

thanks for stopping by!
Yes, indeed TYPECHECK_MEM shows missing 90K+ of memory. It&#039;s nice to know that it is accounted somehow, although not very conveniently I must say.
Another thing that I&#039;ve noticed when I run modified script - if I re-check TYPECHECK_MEM after some inactivity time, it goes to zero (this looks promising - probably the TYPECHECK part is abandoned quickly), but also SHARABLE_MEM increases a bit from 36K to 56K:
[sourcecode lang=&quot;sql&quot;]
        SHARABLE_MEM        TYPECHECK_MEM
-------------------- --------------------
               15624                    0


Explained.


        SHARABLE_MEM        TYPECHECK_MEM
-------------------- --------------------
               36905                96600

SQL&gt; /

        SHARABLE_MEM        TYPECHECK_MEM
-------------------- --------------------
               56418                    0

[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>Hi Tanel,</p>
<p>thanks for stopping by!<br />
Yes, indeed TYPECHECK_MEM shows missing 90K+ of memory. It&#8217;s nice to know that it is accounted somehow, although not very conveniently I must say.<br />
Another thing that I&#8217;ve noticed when I run modified script &#8211; if I re-check TYPECHECK_MEM after some inactivity time, it goes to zero (this looks promising &#8211; probably the TYPECHECK part is abandoned quickly), but also SHARABLE_MEM increases a bit from 36K to 56K:</p>
<pre class="brush: sql; title: ; notranslate">
        SHARABLE_MEM        TYPECHECK_MEM
-------------------- --------------------
               15624                    0


Explained.


        SHARABLE_MEM        TYPECHECK_MEM
-------------------- --------------------
               36905                96600

SQL&gt; /

        SHARABLE_MEM        TYPECHECK_MEM
-------------------- --------------------
               56418                    0

</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: What the heck is the INTERNAL_FUNCTION in execution plan predicate section? &#124; Tanel Poder&#039;s blog: IT &#38; Mobile for Geeks and Pros</title>
		<link>http://timurakhmadeev.wordpress.com/2011/11/24/explain-plan-shared-memory/#comment-1660</link>
		<dc:creator><![CDATA[What the heck is the INTERNAL_FUNCTION in execution plan predicate section? &#124; Tanel Poder&#039;s blog: IT &#38; Mobile for Geeks and Pros]]></dc:creator>
		<pubDate>Thu, 17 Jan 2013 00:41:22 +0000</pubDate>
		<guid isPermaLink="false">http://timurakhmadeev.wordpress.com/?p=734#comment-1660</guid>
		<description><![CDATA[[...] given SQL again, in a special, more instrumented way, it has more information at hand apparently (and it uses more memory too). Or it could just be that whoever wrote V$SQL_PLAN, didn&#8217;t write the piece of code for [...]]]></description>
		<content:encoded><![CDATA[<p>[...] given SQL again, in a special, more instrumented way, it has more information at hand apparently (and it uses more memory too). Or it could just be that whoever wrote V$SQL_PLAN, didn&#8217;t write the piece of code for [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tanel Poder</title>
		<link>http://timurakhmadeev.wordpress.com/2011/11/24/explain-plan-shared-memory/#comment-1659</link>
		<dc:creator><![CDATA[Tanel Poder]]></dc:creator>
		<pubDate>Thu, 17 Jan 2013 00:25:52 +0000</pubDate>
		<guid isPermaLink="false">http://timurakhmadeev.wordpress.com/?p=734#comment-1659</guid>
		<description><![CDATA[Timur, the typecheck memory numbers are not in SHARABLE_MEM, but in TYPECHECK_MEM column in V$SQL... see if this adds up ...]]></description>
		<content:encoded><![CDATA[<p>Timur, the typecheck memory numbers are not in SHARABLE_MEM, but in TYPECHECK_MEM column in V$SQL&#8230; see if this adds up &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oracle database features wish list &#8211; 2 (V$SQL_UNSHARED_CURSOR) &#171; Timur Akhmadeev&#039;s blog</title>
		<link>http://timurakhmadeev.wordpress.com/2011/11/24/explain-plan-shared-memory/#comment-1409</link>
		<dc:creator><![CDATA[Oracle database features wish list &#8211; 2 (V$SQL_UNSHARED_CURSOR) &#171; Timur Akhmadeev&#039;s blog]]></dc:creator>
		<pubDate>Tue, 21 Feb 2012 09:02:13 +0000</pubDate>
		<guid isPermaLink="false">http://timurakhmadeev.wordpress.com/?p=734#comment-1409</guid>
		<description><![CDATA[[...] cursor plus some infrastructure overhead. I don&#8217;t know too much details but compared to a normal child cursor size of 15K, 100-ish bytes doesn&#8217;t look much to me. And the profit would be huge. To support [...]]]></description>
		<content:encoded><![CDATA[<p>[...] cursor plus some infrastructure overhead. I don&#8217;t know too much details but compared to a normal child cursor size of 15K, 100-ish bytes doesn&#8217;t look much to me. And the profit would be huge. To support [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Timur Akhmadeev</title>
		<link>http://timurakhmadeev.wordpress.com/2011/11/24/explain-plan-shared-memory/#comment-1407</link>
		<dc:creator><![CDATA[Timur Akhmadeev]]></dc:creator>
		<pubDate>Mon, 20 Feb 2012 12:57:28 +0000</pubDate>
		<guid isPermaLink="false">http://timurakhmadeev.wordpress.com/?p=734#comment-1407</guid>
		<description><![CDATA[Igor

I think there are cases when wrapping SQL in a view could help in avoiding ORA-4031, like when you use 2 different queries based on the view - I guess. I didn&#039;t test it, so can&#039;t say for sure.]]></description>
		<content:encoded><![CDATA[<p>Igor</p>
<p>I think there are cases when wrapping SQL in a view could help in avoiding ORA-4031, like when you use 2 different queries based on the view &#8211; I guess. I didn&#8217;t test it, so can&#8217;t say for sure.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Igor Usoltsev</title>
		<link>http://timurakhmadeev.wordpress.com/2011/11/24/explain-plan-shared-memory/#comment-1406</link>
		<dc:creator><![CDATA[Igor Usoltsev]]></dc:creator>
		<pubDate>Fri, 17 Feb 2012 14:30:38 +0000</pubDate>
		<guid isPermaLink="false">http://timurakhmadeev.wordpress.com/?p=734#comment-1406</guid>
		<description><![CDATA[Thanks Timur, but I mean your initial huge qry_text size query which got “ORA-04031: unable to allocate 235704 bytes of shared memory (“shared pool”,”select * from (…”,”Typecheck”,”qry_text : qcpisqt”)”
Will shared pool memory usage decrease if this query is wrapped into view?

For example:
SQL&gt; select * from view_maked_from_huge_query_text;

Is this way suitable for ORA-04031 problem resolution?]]></description>
		<content:encoded><![CDATA[<p>Thanks Timur, but I mean your initial huge qry_text size query which got “ORA-04031: unable to allocate 235704 bytes of shared memory (“shared pool”,”select * from (…”,”Typecheck”,”qry_text : qcpisqt”)”<br />
Will shared pool memory usage decrease if this query is wrapped into view?</p>
<p>For example:<br />
SQL&gt; select * from view_maked_from_huge_query_text;</p>
<p>Is this way suitable for ORA-04031 problem resolution?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Timur Akhmadeev</title>
		<link>http://timurakhmadeev.wordpress.com/2011/11/24/explain-plan-shared-memory/#comment-1405</link>
		<dc:creator><![CDATA[Timur Akhmadeev]]></dc:creator>
		<pubDate>Fri, 17 Feb 2012 13:39:08 +0000</pubDate>
		<guid isPermaLink="false">http://timurakhmadeev.wordpress.com/?p=734#comment-1405</guid>
		<description><![CDATA[Hi Igor

First of all I don&#039;t see here a big issue. Yes, EXPLAIN PLAN cursors require some additional memory that looks to be huge enough compared to the statement, but that&#039;s just fine. In a normal system there is no need to run it frequently.
Second, I&#039;m not quite sure what do you mean by &quot;simple view&quot;. In case you think that wrapping SQL in a view such as SELECT * and then explaining it could make these memory chunks disappear, then it&#039;s not true:
[sourcecode lang=&quot;sql&quot;]
SQL&gt;
SQL&gt; explain plan for select * from (select /*+ &amp;uq_id */ count(*) from dual);

Explained.

SQL&gt;
SQL&gt; select sharable_mem
  2    from v$sql
  3   where sql_id = (select s.prev_sql_id from v$session s where sid = userenv(&#039;sid&#039;))
  4     and child_number = (select s.prev_child_number from v$session s where sid = userenv(&#039;sid&#039;));

        SHARABLE_MEM
--------------------
               36961

SQL&gt;
SQL&gt;
SQL&gt; explain plan for select null from (select /*+ &amp;uq_id */ count(*) from dual);

Explained.

SQL&gt;
SQL&gt; select sharable_mem
  2    from v$sql
  3   where sql_id = (select s.prev_sql_id from v$session s where sid = userenv(&#039;sid&#039;))
  4     and child_number = (select s.prev_child_number from v$session s where sid = userenv(&#039;sid&#039;));

        SHARABLE_MEM
--------------------
               36964
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>Hi Igor</p>
<p>First of all I don&#8217;t see here a big issue. Yes, EXPLAIN PLAN cursors require some additional memory that looks to be huge enough compared to the statement, but that&#8217;s just fine. In a normal system there is no need to run it frequently.<br />
Second, I&#8217;m not quite sure what do you mean by &#8220;simple view&#8221;. In case you think that wrapping SQL in a view such as SELECT * and then explaining it could make these memory chunks disappear, then it&#8217;s not true:</p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt;
SQL&gt; explain plan for select * from (select /*+ &amp;uq_id */ count(*) from dual);

Explained.

SQL&gt;
SQL&gt; select sharable_mem
  2    from v$sql
  3   where sql_id = (select s.prev_sql_id from v$session s where sid = userenv('sid'))
  4     and child_number = (select s.prev_child_number from v$session s where sid = userenv('sid'));

        SHARABLE_MEM
--------------------
               36961

SQL&gt;
SQL&gt;
SQL&gt; explain plan for select null from (select /*+ &amp;uq_id */ count(*) from dual);

Explained.

SQL&gt;
SQL&gt; select sharable_mem
  2    from v$sql
  3   where sql_id = (select s.prev_sql_id from v$session s where sid = userenv('sid'))
  4     and child_number = (select s.prev_child_number from v$session s where sid = userenv('sid'));

        SHARABLE_MEM
--------------------
               36964
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Igor Usoltsev</title>
		<link>http://timurakhmadeev.wordpress.com/2011/11/24/explain-plan-shared-memory/#comment-1404</link>
		<dc:creator><![CDATA[Igor Usoltsev]]></dc:creator>
		<pubDate>Fri, 17 Feb 2012 08:07:57 +0000</pubDate>
		<guid isPermaLink="false">http://timurakhmadeev.wordpress.com/?p=734#comment-1404</guid>
		<description><![CDATA[Thanks Timur, very interesting post
As far as I understand the simple view usage can help to resolve problem, isn&#039;t it?
Igor]]></description>
		<content:encoded><![CDATA[<p>Thanks Timur, very interesting post<br />
As far as I understand the simple view usage can help to resolve problem, isn&#8217;t it?<br />
Igor</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://timurakhmadeev.wordpress.com/2011/11/24/explain-plan-shared-memory/#comment-1265</link>
		<dc:creator><![CDATA[Greg]]></dc:creator>
		<pubDate>Thu, 24 Nov 2011 19:09:02 +0000</pubDate>
		<guid isPermaLink="false">http://timurakhmadeev.wordpress.com/?p=734#comment-1265</guid>
		<description><![CDATA[Great blog. I remember similar situation with rule based optimizer where query had big inlist and plan was huge because of redundant index unix scans .
So, simple explain blew out our production till slush shared pool because of fragmentation . That was in 9.2 DB
Regards
GregG]]></description>
		<content:encoded><![CDATA[<p>Great blog. I remember similar situation with rule based optimizer where query had big inlist and plan was huge because of redundant index unix scans .<br />
So, simple explain blew out our production till slush shared pool because of fragmentation . That was in 9.2 DB<br />
Regards<br />
GregG</p>
]]></content:encoded>
	</item>
</channel>
</rss>
