<?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: Histograms and Bind Variables, But Why?</title>
	<atom:link href="http://hoopercharles.wordpress.com/2011/01/29/histograms-and-bind-variables-but-why/feed/" rel="self" type="application/rss+xml" />
	<link>http://hoopercharles.wordpress.com/2011/01/29/histograms-and-bind-variables-but-why/</link>
	<description>Miscellaneous Random Oracle Topics: Stop, Think, ... Understand</description>
	<lastBuildDate>Thu, 23 May 2013 04:02:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Same SQL_ID with Different Execution Plans &#171; Anand&#039;s Blog</title>
		<link>http://hoopercharles.wordpress.com/2011/01/29/histograms-and-bind-variables-but-why/#comment-2798</link>
		<dc:creator><![CDATA[Same SQL_ID with Different Execution Plans &#171; Anand&#039;s Blog]]></dc:creator>
		<pubDate>Mon, 07 Feb 2011 10:00:19 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4295#comment-2798</guid>
		<description><![CDATA[[...] http://hoopercharles.wordpress.com/2011/01/29/histograms-and-bind-variables-but-why/ [...]]]></description>
		<content:encoded><![CDATA[<p>[...] <a href="http://hoopercharles.wordpress.com/2011/01/29/histograms-and-bind-variables-but-why/" rel="nofollow">http://hoopercharles.wordpress.com/2011/01/29/histograms-and-bind-variables-but-why/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ravi</title>
		<link>http://hoopercharles.wordpress.com/2011/01/29/histograms-and-bind-variables-but-why/#comment-2782</link>
		<dc:creator><![CDATA[Ravi]]></dc:creator>
		<pubDate>Wed, 02 Feb 2011 21:57:48 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4295#comment-2782</guid>
		<description><![CDATA[The topics not covered by many are 1) how do we do a good capacity planning for oracle DB using the current workload? What is a good scentific way to arrive at the capacity( CPU, memory and I/O) needs of a DB server? Could you please share your thoughts on these topics?]]></description>
		<content:encoded><![CDATA[<p>The topics not covered by many are 1) how do we do a good capacity planning for oracle DB using the current workload? What is a good scentific way to arrive at the capacity( CPU, memory and I/O) needs of a DB server? Could you please share your thoughts on these topics?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2011/01/29/histograms-and-bind-variables-but-why/#comment-2773</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Mon, 31 Jan 2011 19:54:04 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4295#comment-2773</guid>
		<description><![CDATA[Centinul,
Great idea for an enhancement, and probably would have saved me from having to derive the fact that the execution plan was not designed just for the current bind variable values.  

I mentioned the PEEKED_BINDS format parameter here, but oddly in the example at the end of the article the bind variable values did not display:
http://hoopercharles.wordpress.com/2010/03/01/dbms_xplan-format-parameters/

Jonathan Lewis also covered the topic, including a couple of different ways to examine bind variable values used in SQL statements:
http://jonathanlewis.wordpress.com/2008/07/24/bind-capture/

One of those methods involves querying V$SQL_BIND_DATA, which according to the documentation, will only show the bind variables submitted by the current session for SQL statements executed by the current session:
http://download.oracle.com/docs/cd/E14072_01/server.112/e10820/dynviews_3044.htm]]></description>
		<content:encoded><![CDATA[<p>Centinul,<br />
Great idea for an enhancement, and probably would have saved me from having to derive the fact that the execution plan was not designed just for the current bind variable values.  </p>
<p>I mentioned the PEEKED_BINDS format parameter here, but oddly in the example at the end of the article the bind variable values did not display:<br />
<a href="http://hoopercharles.wordpress.com/2010/03/01/dbms_xplan-format-parameters/" rel="nofollow">http://hoopercharles.wordpress.com/2010/03/01/dbms_xplan-format-parameters/</a></p>
<p>Jonathan Lewis also covered the topic, including a couple of different ways to examine bind variable values used in SQL statements:<br />
<a href="http://jonathanlewis.wordpress.com/2008/07/24/bind-capture/" rel="nofollow">http://jonathanlewis.wordpress.com/2008/07/24/bind-capture/</a></p>
<p>One of those methods involves querying V$SQL_BIND_DATA, which according to the documentation, will only show the bind variables submitted by the current session for SQL statements executed by the current session:<br />
<a href="http://download.oracle.com/docs/cd/E14072_01/server.112/e10820/dynviews_3044.htm" rel="nofollow">http://download.oracle.com/docs/cd/E14072_01/server.112/e10820/dynviews_3044.htm</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Centinul</title>
		<link>http://hoopercharles.wordpress.com/2011/01/29/histograms-and-bind-variables-but-why/#comment-2772</link>
		<dc:creator><![CDATA[Centinul]]></dc:creator>
		<pubDate>Mon, 31 Jan 2011 16:20:58 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4295#comment-2772</guid>
		<description><![CDATA[Charles --

Excellent work as usual. There is an option to the DISPLAY_CURSOR format parameter that allows you to display the peeked bind variables. So your command would look like:

&lt;code&gt;SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,&#039;ALLSTATS LAST +PEEKED_BINDS&#039;));&lt;/code&gt;

Here is the output from your first run with the +PEEKED_BINDS option:

[code]SQL &gt; VARIABLE N1 NUMBER
SQL &gt; EXEC :N1:=2

PL/SQL procedure successfully completed.

SQL &gt; SELECT /*+ GATHER_PLAN_STATISTICS */
  2    C1,
  3    C2
  4  FROM
  5    T1
  6  WHERE
  7    C2 = :N1;

no rows selected

SQL &gt; SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,&#039;ALLSTATS LAST +PEEKED_BINDS&#039;));

PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------------

SQL_ID  c7su63uw7nch6, child number 0
-------------------------------------
SELECT /*+ GATHER_PLAN_STATISTICS */   C1,   C2 FROM   T1 WHERE   C2 =
:N1

Plan hash value: 236868917

------------------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                   &#124; Name      &#124; Starts &#124; E-Rows &#124; A-Rows &#124;   A-Time   &#124; Buffers &#124; Reads  &#124;
------------------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT            &#124;           &#124;      1 &#124;        &#124;      0 &#124;00:00:00.01 &#124;       3 &#124;   1 &#124;
&#124;   1 &#124;  TABLE ACCESS BY INDEX ROWID&#124; T1        &#124;      1 &#124;   4322 &#124;      0 &#124;00:00:00.01 &#124;       3 &#124;   1 &#124;
&#124;*  2 &#124;   INDEX RANGE SCAN          &#124; IND_T1_C2 &#124;      1 &#124;   4322 &#124;      0 &#124;00:00:00.01 &#124;       3 &#124;   1 &#124;
------------------------------------------------------------------------------------------------------------

Peeked Binds (identified by position):
--------------------------------------

   1 - (NUMBER): 2

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access(&quot;C2&quot;=:N1)[/code]

Now running with this:

[code]SQL &gt; VARIABLE N1 NUMBER
SQL &gt; EXEC :N1:=99&lt;/code&gt;

We see:

&lt;code&gt;SQL &gt; SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,&#039;ALLSTATS LAST +PEEKED_BINDS&#039;));

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------

SQL_ID  c7su63uw7nch6, child number 0
-------------------------------------
SELECT /*+ GATHER_PLAN_STATISTICS */   C1,   C2 FROM   T1 WHERE   C2 =
:N1

Plan hash value: 236868917

------------------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                   &#124; Name      &#124; Starts &#124; E-Rows &#124; A-Rows &#124;   A-Time   &#124; Buffers &#124; Reads  &#124;
------------------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT            &#124;           &#124;      1 &#124;        &#124;  10000 &#124;00:00:00.06 &#124;    1781 &#124;  86 &#124;
&#124;   1 &#124;  TABLE ACCESS BY INDEX ROWID&#124; T1        &#124;      1 &#124;   4322 &#124;  10000 &#124;00:00:00.06 &#124;    1781 &#124;  86 &#124;
&#124;*  2 &#124;   INDEX RANGE SCAN          &#124; IND_T1_C2 &#124;      1 &#124;   4322 &#124;  10000 &#124;00:00:00.04 &#124;     690 &#124;   0 &#124;
------------------------------------------------------------------------------------------------------------

Peeked Binds (identified by position):
--------------------------------------

   1 - (NUMBER): 2

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access(&quot;C2&quot;=:N1)[/code]

We still see that the peeked value has not changed at all. I think this new section in the execution plan helps further illustrate this point. 

This was all run from an 11.2.0.2 environment.]]></description>
		<content:encoded><![CDATA[<p>Charles &#8211;</p>
<p>Excellent work as usual. There is an option to the DISPLAY_CURSOR format parameter that allows you to display the peeked bind variables. So your command would look like:</p>
<p><code>SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'ALLSTATS LAST +PEEKED_BINDS'));</code></p>
<p>Here is the output from your first run with the +PEEKED_BINDS option:</p>
<pre class="brush: plain; title: ; notranslate">SQL &gt; VARIABLE N1 NUMBER
SQL &gt; EXEC :N1:=2

PL/SQL procedure successfully completed.

SQL &gt; SELECT /*+ GATHER_PLAN_STATISTICS */
  2    C1,
  3    C2
  4  FROM
  5    T1
  6  WHERE
  7    C2 = :N1;

no rows selected

SQL &gt; SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'ALLSTATS LAST +PEEKED_BINDS'));

PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------------

SQL_ID  c7su63uw7nch6, child number 0
-------------------------------------
SELECT /*+ GATHER_PLAN_STATISTICS */   C1,   C2 FROM   T1 WHERE   C2 =
:N1

Plan hash value: 236868917

------------------------------------------------------------------------------------------------------------
| Id  | Operation                   | Name      | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |
------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |           |      1 |        |      0 |00:00:00.01 |       3 |   1 |
|   1 |  TABLE ACCESS BY INDEX ROWID| T1        |      1 |   4322 |      0 |00:00:00.01 |       3 |   1 |
|*  2 |   INDEX RANGE SCAN          | IND_T1_C2 |      1 |   4322 |      0 |00:00:00.01 |       3 |   1 |
------------------------------------------------------------------------------------------------------------

Peeked Binds (identified by position):
--------------------------------------

   1 - (NUMBER): 2

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access(&quot;C2&quot;=:N1)</pre>
<p>Now running with this:</p>
<pre class="brush: plain; title: ; notranslate">SQL &gt; VARIABLE N1 NUMBER
SQL &gt; EXEC :N1:=99&lt;/code&gt;

We see:

&lt;code&gt;SQL &gt; SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'ALLSTATS LAST +PEEKED_BINDS'));

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------

SQL_ID  c7su63uw7nch6, child number 0
-------------------------------------
SELECT /*+ GATHER_PLAN_STATISTICS */   C1,   C2 FROM   T1 WHERE   C2 =
:N1

Plan hash value: 236868917

------------------------------------------------------------------------------------------------------------
| Id  | Operation                   | Name      | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |
------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |           |      1 |        |  10000 |00:00:00.06 |    1781 |  86 |
|   1 |  TABLE ACCESS BY INDEX ROWID| T1        |      1 |   4322 |  10000 |00:00:00.06 |    1781 |  86 |
|*  2 |   INDEX RANGE SCAN          | IND_T1_C2 |      1 |   4322 |  10000 |00:00:00.04 |     690 |   0 |
------------------------------------------------------------------------------------------------------------

Peeked Binds (identified by position):
--------------------------------------

   1 - (NUMBER): 2

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access(&quot;C2&quot;=:N1)</pre>
<p>We still see that the peeked value has not changed at all. I think this new section in the execution plan helps further illustrate this point. </p>
<p>This was all run from an 11.2.0.2 environment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: neerajbhatia</title>
		<link>http://hoopercharles.wordpress.com/2011/01/29/histograms-and-bind-variables-but-why/#comment-2765</link>
		<dc:creator><![CDATA[neerajbhatia]]></dc:creator>
		<pubDate>Sun, 30 Jan 2011 07:21:12 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4295#comment-2765</guid>
		<description><![CDATA[Hi Charles,

What a perfect  timing! I was working on part-2 of my &quot;Everything you want to know about Oracle Histogram&quot; series and then yesterday  I found your post.

Anyway, it&#039;s very well written and left no scope of improvement for me!

Appreciate your good work.  

Cheers, Neeraj]]></description>
		<content:encoded><![CDATA[<p>Hi Charles,</p>
<p>What a perfect  timing! I was working on part-2 of my &#8220;Everything you want to know about Oracle Histogram&#8221; series and then yesterday  I found your post.</p>
<p>Anyway, it&#8217;s very well written and left no scope of improvement for me!</p>
<p>Appreciate your good work.  </p>
<p>Cheers, Neeraj</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amardeep Sidhu</title>
		<link>http://hoopercharles.wordpress.com/2011/01/29/histograms-and-bind-variables-but-why/#comment-2763</link>
		<dc:creator><![CDATA[Amardeep Sidhu]]></dc:creator>
		<pubDate>Sun, 30 Jan 2011 04:06:27 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4295#comment-2763</guid>
		<description><![CDATA[Nice post Charles !]]></description>
		<content:encoded><![CDATA[<p>Nice post Charles !</p>
]]></content:encoded>
	</item>
</channel>
</rss>
