<?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: DBMS_STATS, METHOD_OPT and FOR ALL INDEXED COLUMNS</title>
	<atom:link href="http://structureddata.org/2008/10/14/dbms_stats-method_opt-and-for-all-indexed-columns/feed/" rel="self" type="application/rss+xml" />
	<link>http://structureddata.org/2008/10/14/dbms_stats-method_opt-and-for-all-indexed-columns/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dbms_stats-method_opt-and-for-all-indexed-columns</link>
	<description>Data, Databases, Performance &#38; Scalability</description>
	<lastBuildDate>Sun, 13 May 2012 01:52:50 -0400</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Greg Rahn</title>
		<link>http://structureddata.org/2008/10/14/dbms_stats-method_opt-and-for-all-indexed-columns/#comment-25994</link>
		<dc:creator>Greg Rahn</dc:creator>
		<pubDate>Fri, 09 Mar 2012 19:52:29 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=190#comment-25994</guid>
		<description>I&#039;d suggest opening up the documentation where it is discussed:
http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_stats.htm#r4c1-t43</description>
		<content:encoded><![CDATA[<p>I&#8217;d suggest opening up the documentation where it is discussed:<br />
<a href="http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_stats.htm#r4c1-t43" rel="nofollow">http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_stats.htm#r4c1-t43</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JOHN</title>
		<link>http://structureddata.org/2008/10/14/dbms_stats-method_opt-and-for-all-indexed-columns/#comment-25980</link>
		<dc:creator>JOHN</dc:creator>
		<pubDate>Fri, 09 Mar 2012 06:12:11 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=190#comment-25980</guid>
		<description>Hi, 
Guys What do you mean by SKEW OPTION in method_opt parameter. And What should i do to gathering statistics in a very minimum time. i got table which has 12 lacs records so, what should i do?</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Guys What do you mean by SKEW OPTION in method_opt parameter. And What should i do to gathering statistics in a very minimum time. i got table which has 12 lacs records so, what should i do?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg Rahn</title>
		<link>http://structureddata.org/2008/10/14/dbms_stats-method_opt-and-for-all-indexed-columns/#comment-25043</link>
		<dc:creator>Greg Rahn</dc:creator>
		<pubDate>Thu, 29 Dec 2011 18:00:25 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=190#comment-25043</guid>
		<description>Do note, you are taking that comment out of context.  It is 100% correct as stated, but it is not meant to cover 100% of the use cases.
Notice that I say if there are no stats, then dynamic sampling is guaranteed to kick in (given default parameters and it meets the criteria), however, I &lt;em&gt;do not&lt;/em&gt; say dynamic sampling won&#039;t kick in if the table does have stats.  Stating the positive does not negate the negative.
It&#039;s all in the documentation: http://docs.oracle.com/cd/E11882_01/server.112/e16638/stats.htm#CHDHAFBJ

In your case dynamic sampling kicks in no matter what because you have a type conversion: the bind variable is a number, but the column is a string.</description>
		<content:encoded><![CDATA[<p>Do note, you are taking that comment out of context.  It is 100% correct as stated, but it is not meant to cover 100% of the use cases.<br />
Notice that I say if there are no stats, then dynamic sampling is guaranteed to kick in (given default parameters and it meets the criteria), however, I <em>do not</em> say dynamic sampling won&#8217;t kick in if the table does have stats.  Stating the positive does not negate the negative.<br />
It&#8217;s all in the documentation: <a href="http://docs.oracle.com/cd/E11882_01/server.112/e16638/stats.htm#CHDHAFBJ" rel="nofollow">http://docs.oracle.com/cd/E11882_01/server.112/e16638/stats.htm#CHDHAFBJ</a></p>
<p>In your case dynamic sampling kicks in no matter what because you have a type conversion: the bind variable is a number, but the column is a string.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Khurram</title>
		<link>http://structureddata.org/2008/10/14/dbms_stats-method_opt-and-for-all-indexed-columns/#comment-25032</link>
		<dc:creator>Khurram</dc:creator>
		<pubDate>Thu, 29 Dec 2011 09:43:19 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=190#comment-25032</guid>
		<description>Greg great article , one thing i intend to clear that you said

&quot;Obviously if the table has no stats (as in your test case) or you use an explicit hint, dynamic sampling will kick in, even with bind variables.&quot;

dynamic simply will kick in either you have stats or not.
&lt;pre&gt;
SQL&gt; create table regions2
  2  (region_id  varchar2(10) primary key,
  3   region_name varchar2(25))
  4  /

Table created.

SQL&gt; insert into regions2 values (&#039;1&#039;,&#039;A&#039;)
  2  /

1 row created.

SQL&gt; insert into regions2 values (2,&#039;B&#039;)
  2  /

1 row created.

SQL&gt; insert into regions2 values (&#039;3&#039;,&#039;C&#039;)
  2  /

1 row created.

SQL&gt; insert into regions2 values (&#039;4&#039;,&#039;D&#039;)
  2  /

1 row created.

SQL&gt; commit
  2  /

Commit complete.

SQL&gt; select * from regions2
  2  /

REGION_ID  REGION_NAME
---------- -------------------------
1          A
2          B
3          C
4          D

SQL&gt; variable regid number
SQL&gt; exec :regid:=1

PL/SQL procedure successfully completed.

SQL&gt; select /*+ gather_plan_statistics */ *
  2    from regions2
  3   where region_id=:regid
  4  /

REGION_ID  REGION_NAME
---------- -------------------------
1          A

SQL&gt; SELECT * FROM table(dbms_xplan.display_cursor(NULL,NULL,&#039;ALLSTATS LAST&#039;))
  2  /

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
SQL_ID  27wd2gm8ruukh, child number 0
-------------------------------------
select /*+ gather_plan_statistics */ *   from regions2   where region_id=:regid

Plan hash value: 670750275

----------------------------------------------------------------------------------------
&#124; Id  &#124; Operation         &#124; Name     &#124; Starts &#124; E-Rows &#124; A-Rows &#124;   A-Time   &#124; Buffers &#124;
----------------------------------------------------------------------------------------
&#124;*  1 &#124;  TABLE ACCESS FULL&#124; REGIONS2 &#124;      1 &#124;      1 &#124;      1 &#124;00:00:00.01 &#124;      16 &#124;
----------------------------------------------------------------------------------------

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

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

   1 - filter(TO_NUMBER(&quot;REGION_ID&quot;)=:REGID)

Note
-----
   - dynamic sampling used for this statement


21 rows selected.

SQL&gt; exec dbms_stats.gather_table_stats(&#039;APPS&#039;,&#039;REGIONS2&#039;,cascade=&gt;true,method_opt=&gt;&#039;for all columns size 254&#039;)

PL/SQL procedure successfully completed.

SQL&gt; select /*+ gather_plan_statistics */ *
  2    from regions2
  3    where region_id=:regid
  4  /

REGION_ID  REGION_NAME
---------- -------------------------
1          A

SQL&gt; SELECT * FROM table(dbms_xplan.display_cursor(NULL,NULL,&#039;ALLSTATS LAST&#039;))
  2  /

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
SQL_ID  27wd2gm8ruukh, child number 0
-------------------------------------
select /*+ gather_plan_statistics */ *   from regions2   where region_id=:regid

Plan hash value: 670750275

----------------------------------------------------------------------------------------
&#124; Id  &#124; Operation         &#124; Name     &#124; Starts &#124; E-Rows &#124; A-Rows &#124;   A-Time   &#124; Buffers &#124;
----------------------------------------------------------------------------------------
&#124;*  1 &#124;  TABLE ACCESS FULL&#124; REGIONS2 &#124;      1 &#124;      1 &#124;      1 &#124;00:00:00.01 &#124;      16 &#124;
----------------------------------------------------------------------------------------

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

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

   1 - filter(TO_NUMBER(&quot;REGION_ID&quot;)=:REGID)

Note
-----
   - dynamic sampling used for this statement


21 rows selected.
&lt;/pre&gt;

Khurram</description>
		<content:encoded><![CDATA[<p>Greg great article , one thing i intend to clear that you said</p>
<p>&#8220;Obviously if the table has no stats (as in your test case) or you use an explicit hint, dynamic sampling will kick in, even with bind variables.&#8221;</p>
<p>dynamic simply will kick in either you have stats or not.</p>
<pre>
SQL&gt; create table regions2
  2  (region_id  varchar2(10) primary key,
  3   region_name varchar2(25))
  4  /

Table created.

SQL&gt; insert into regions2 values ('1','A')
  2  /

1 row created.

SQL&gt; insert into regions2 values (2,'B')
  2  /

1 row created.

SQL&gt; insert into regions2 values ('3','C')
  2  /

1 row created.

SQL&gt; insert into regions2 values ('4','D')
  2  /

1 row created.

SQL&gt; commit
  2  /

Commit complete.

SQL&gt; select * from regions2
  2  /

REGION_ID  REGION_NAME
---------- -------------------------
1          A
2          B
3          C
4          D

SQL&gt; variable regid number
SQL&gt; exec :regid:=1

PL/SQL procedure successfully completed.

SQL&gt; select /*+ gather_plan_statistics */ *
  2    from regions2
  3   where region_id=:regid
  4  /

REGION_ID  REGION_NAME
---------- -------------------------
1          A

SQL&gt; SELECT * FROM table(dbms_xplan.display_cursor(NULL,NULL,'ALLSTATS LAST'))
  2  /

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
SQL_ID  27wd2gm8ruukh, child number 0
-------------------------------------
select /*+ gather_plan_statistics */ *   from regions2   where region_id=:regid

Plan hash value: 670750275

----------------------------------------------------------------------------------------
| Id  | Operation         | Name     | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
----------------------------------------------------------------------------------------
|*  1 |  TABLE ACCESS FULL| REGIONS2 |      1 |      1 |      1 |00:00:00.01 |      16 |
----------------------------------------------------------------------------------------

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

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

   1 - filter(TO_NUMBER("REGION_ID")=:REGID)

Note
-----
   - dynamic sampling used for this statement

21 rows selected.

SQL&gt; exec dbms_stats.gather_table_stats('APPS','REGIONS2',cascade=&gt;true,method_opt=&gt;'for all columns size 254')

PL/SQL procedure successfully completed.

SQL&gt; select /*+ gather_plan_statistics */ *
  2    from regions2
  3    where region_id=:regid
  4  /

REGION_ID  REGION_NAME
---------- -------------------------
1          A

SQL&gt; SELECT * FROM table(dbms_xplan.display_cursor(NULL,NULL,'ALLSTATS LAST'))
  2  /

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
SQL_ID  27wd2gm8ruukh, child number 0
-------------------------------------
select /*+ gather_plan_statistics */ *   from regions2   where region_id=:regid

Plan hash value: 670750275

----------------------------------------------------------------------------------------
| Id  | Operation         | Name     | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
----------------------------------------------------------------------------------------
|*  1 |  TABLE ACCESS FULL| REGIONS2 |      1 |      1 |      1 |00:00:00.01 |      16 |
----------------------------------------------------------------------------------------

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

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

   1 - filter(TO_NUMBER("REGION_ID")=:REGID)

Note
-----
   - dynamic sampling used for this statement

21 rows selected.
</pre>
<p>Khurram</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg Rahn</title>
		<link>http://structureddata.org/2008/10/14/dbms_stats-method_opt-and-for-all-indexed-columns/#comment-24717</link>
		<dc:creator>Greg Rahn</dc:creator>
		<pubDate>Tue, 13 Dec 2011 00:45:16 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=190#comment-24717</guid>
		<description>The degree parameter for dbms_stats.gather_table_stats has nothing to do with any knowledge of data distribution in the table -- it is for how many parallel servers should execute this work.  It&#039;s all in the documentation:
http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_stats.htm#r8c1-t49</description>
		<content:encoded><![CDATA[<p>The degree parameter for dbms_stats.gather_table_stats has nothing to do with any knowledge of data distribution in the table &#8212; it is for how many parallel servers should execute this work.  It&#8217;s all in the documentation:<br />
<a href="http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_stats.htm#r8c1-t49" rel="nofollow">http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_stats.htm#r8c1-t49</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Khurram</title>
		<link>http://structureddata.org/2008/10/14/dbms_stats-method_opt-and-for-all-indexed-columns/#comment-24713</link>
		<dc:creator>Khurram</dc:creator>
		<pubDate>Mon, 12 Dec 2011 18:55:07 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=190#comment-24713</guid>
		<description>Hi Greg,

How did you know the degree of uneven distribution? I mean you used degree=&gt;8 , how come you know the skewness for which you used degree=&gt;8 , is it documented by oracle that what degree we need to use for what sort of data? Its not clear to me degree=&gt;8 why not 9 and 10 ...n?

Khurram</description>
		<content:encoded><![CDATA[<p>Hi Greg,</p>
<p>How did you know the degree of uneven distribution? I mean you used degree=&gt;8 , how come you know the skewness for which you used degree=&gt;8 , is it documented by oracle that what degree we need to use for what sort of data? Its not clear to me degree=&gt;8 why not 9 and 10 &#8230;n?</p>
<p>Khurram</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg Rahn</title>
		<link>http://structureddata.org/2008/10/14/dbms_stats-method_opt-and-for-all-indexed-columns/#comment-22730</link>
		<dc:creator>Greg Rahn</dc:creator>
		<pubDate>Thu, 08 Sep 2011 16:46:18 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=190#comment-22730</guid>
		<description>Have you actually read my prior responses?  This has already been discussed.</description>
		<content:encoded><![CDATA[<p>Have you actually read my prior responses?  This has already been discussed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg Rahn</title>
		<link>http://structureddata.org/2008/10/14/dbms_stats-method_opt-and-for-all-indexed-columns/#comment-22729</link>
		<dc:creator>Greg Rahn</dc:creator>
		<pubDate>Thu, 08 Sep 2011 16:44:50 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=190#comment-22729</guid>
		<description>Have you actually read my prior response?  The part where I say:&quot;You should recognize the examples are not about full table scan or not.&quot;</description>
		<content:encoded><![CDATA[<p>Have you actually read my prior response?  The part where I say:&#8221;You should recognize the examples are not about full table scan or not.&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GP</title>
		<link>http://structureddata.org/2008/10/14/dbms_stats-method_opt-and-for-all-indexed-columns/#comment-22712</link>
		<dc:creator>GP</dc:creator>
		<pubDate>Wed, 07 Sep 2011 15:50:30 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=190#comment-22712</guid>
		<description>why bother with cardinality when full table scanning, unless histograms store physical addresses and allow a query to determine which rows are read based on physical addresses stored in histogram buckets? cardinality helps indexing not full scans. full scans read disk in contiguous blocks in physical order, random access, why would cardinality be an issue. And warehouses without indexes are are unindexed because they read all the data anyway and it&#039;s faster to full scan the tables rather than read index + tables. In my experience, the only reason to index a warehouse is PKs on dimensions (could be uniques maybe) and non-constrained indexes on FK inversions in facts - all for kjoining and sometimes bitmaps on fact FKs (not really FKs) can help depending on data volatility. If there are no dimensions and/or there are mutliple  facts and joins between them then the only thing that generally helps is partitioning under the assumption that data is read in full tables or full partitions. However, the next time I build a warehouse I will experiment with histograms on non keyed columns just to see what they do with optimized WHERE clauses, i do know for a fact that index searches on histogramm&#039;ed indexed columns can make huge differences, but again, my overall strategy with a warehouse is often to remove all indexing and use partition keys (usually).</description>
		<content:encoded><![CDATA[<p>why bother with cardinality when full table scanning, unless histograms store physical addresses and allow a query to determine which rows are read based on physical addresses stored in histogram buckets? cardinality helps indexing not full scans. full scans read disk in contiguous blocks in physical order, random access, why would cardinality be an issue. And warehouses without indexes are are unindexed because they read all the data anyway and it&#8217;s faster to full scan the tables rather than read index + tables. In my experience, the only reason to index a warehouse is PKs on dimensions (could be uniques maybe) and non-constrained indexes on FK inversions in facts &#8211; all for kjoining and sometimes bitmaps on fact FKs (not really FKs) can help depending on data volatility. If there are no dimensions and/or there are mutliple  facts and joins between them then the only thing that generally helps is partitioning under the assumption that data is read in full tables or full partitions. However, the next time I build a warehouse I will experiment with histograms on non keyed columns just to see what they do with optimized WHERE clauses, i do know for a fact that index searches on histogramm&#8217;ed indexed columns can make huge differences, but again, my overall strategy with a warehouse is often to remove all indexing and use partition keys (usually).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GP</title>
		<link>http://structureddata.org/2008/10/14/dbms_stats-method_opt-and-for-all-indexed-columns/#comment-22711</link>
		<dc:creator>GP</dc:creator>
		<pubDate>Wed, 07 Sep 2011 15:42:40 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=190#comment-22711</guid>
		<description>dynamic sampling not used for bind variables is incorrect? I am inclined to agree. It doesn&#039;t make any sense.</description>
		<content:encoded><![CDATA[<p>dynamic sampling not used for bind variables is incorrect? I am inclined to agree. It doesn&#8217;t make any sense.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced (User agent is rejected)
Database Caching 7/11 queries in 0.004 seconds using disk: basic
Object Caching 415/444 objects using disk: basic

Served from: structureddata.org @ 2012-05-17 07:53:08 -->
