<?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: Oracle 11g: Incremental Global Statistics On Partitioned Tables</title>
	<atom:link href="http://structureddata.org/2008/07/16/oracle-11g-incremental-global-statistics-on-partitioned-tables/feed/" rel="self" type="application/rss+xml" />
	<link>http://structureddata.org/2008/07/16/oracle-11g-incremental-global-statistics-on-partitioned-tables/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=oracle-11g-incremental-global-statistics-on-partitioned-tables</link>
	<description>Data, Databases, Performance &#38; Scalability</description>
	<lastBuildDate>Mon, 30 Jan 2012 17:05:12 -0500</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Greg Rahn</title>
		<link>http://structureddata.org/2008/07/16/oracle-11g-incremental-global-statistics-on-partitioned-tables/#comment-23991</link>
		<dc:creator>Greg Rahn</dc:creator>
		<pubDate>Thu, 27 Oct 2011 00:59:29 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=70#comment-23991</guid>
		<description>I only have a base 11.1 setup and I have not tried it.</description>
		<content:encoded><![CDATA[<p>I only have a base 11.1 setup and I have not tried it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DBA</title>
		<link>http://structureddata.org/2008/07/16/oracle-11g-incremental-global-statistics-on-partitioned-tables/#comment-23976</link>
		<dc:creator>DBA</dc:creator>
		<pubDate>Wed, 26 Oct 2011 14:09:13 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=70#comment-23976</guid>
		<description>Greg, did you have a chance to test my small test case on 11.1? We applied SP9 to our 11.1.0.7 version and I am still not seeing the incremental stats work as expected.</description>
		<content:encoded><![CDATA[<p>Greg, did you have a chance to test my small test case on 11.1? We applied SP9 to our 11.1.0.7 version and I am still not seeing the incremental stats work as expected.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DBA</title>
		<link>http://structureddata.org/2008/07/16/oracle-11g-incremental-global-statistics-on-partitioned-tables/#comment-17897</link>
		<dc:creator>DBA</dc:creator>
		<pubDate>Fri, 20 May 2011 21:08:58 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=70#comment-17897</guid>
		<description>ghassan,
I did not try that, but granularity by default is AUTO. Anyway it&#039;s good to know that it is fixed in 11.2.0.2.</description>
		<content:encoded><![CDATA[<p>ghassan,<br />
I did not try that, but granularity by default is AUTO. Anyway it&#8217;s good to know that it is fixed in 11.2.0.2.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ghassan</title>
		<link>http://structureddata.org/2008/07/16/oracle-11g-incremental-global-statistics-on-partitioned-tables/#comment-17757</link>
		<dc:creator>ghassan</dc:creator>
		<pubDate>Fri, 13 May 2011 16:34:26 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=70#comment-17757</guid>
		<description>DBA,
I tried your testcase on an 11.2.0.2 (don&#039;t have access to 11.1), and it does not reproduce.
on your version, did you try on an 11.1, without specifying the &#039;granularity&#039;?</description>
		<content:encoded><![CDATA[<p>DBA,<br />
I tried your testcase on an 11.2.0.2 (don&#8217;t have access to 11.1), and it does not reproduce.<br />
on your version, did you try on an 11.1, without specifying the &#8216;granularity&#8217;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg Rahn</title>
		<link>http://structureddata.org/2008/07/16/oracle-11g-incremental-global-statistics-on-partitioned-tables/#comment-17300</link>
		<dc:creator>Greg Rahn</dc:creator>
		<pubDate>Mon, 11 Apr 2011 18:09:38 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=70#comment-17300</guid>
		<description>No worries - it&#039;s &lt;strong&gt;[sourcecode][/sourcecode]&lt;/strong&gt;.  I&#039;ve added it.  I&#039;ll look at this when I have a spare moment and get back.  Stay tuned!</description>
		<content:encoded><![CDATA[<p>No worries &#8211; it&#8217;s <strong></strong>.  I&#8217;ve added it.  I&#8217;ll look at this when I have a spare moment and get back.  Stay tuned!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DBA</title>
		<link>http://structureddata.org/2008/07/16/oracle-11g-incremental-global-statistics-on-partitioned-tables/#comment-17299</link>
		<dc:creator>DBA</dc:creator>
		<pubDate>Mon, 11 Apr 2011 16:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=70#comment-17299</guid>
		<description>Sorry about the formatting. I tried {code} tag but it didn&#039;t work.</description>
		<content:encoded><![CDATA[<p>Sorry about the formatting. I tried {code} tag but it didn&#8217;t work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DBA</title>
		<link>http://structureddata.org/2008/07/16/oracle-11g-incremental-global-statistics-on-partitioned-tables/#comment-17298</link>
		<dc:creator>DBA</dc:creator>
		<pubDate>Mon, 11 Apr 2011 16:25:06 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=70#comment-17298</guid>
		<description>Here is the test case. Watch for the last_analyzed column.

[sourcecode]

SQL&gt; ALTER SESSION SET nls_date_format=&#039;DD-MON-YYYY HH12:MI:SS AM&#039;;

Session altered.

SQL&gt; 
SQL&gt; DROP TABLE t PURGE;

Table dropped.

SQL&gt; prompt ==&gt;Create a partitioned table T using interval partitioning
==&gt;Create a partitioned table T using interval partitioning
SQL&gt; 
SQL&gt; CREATE TABLE t (
  2  id NUMBER CONSTRAINT pk_t PRIMARY KEY,
  3  sample_time DATE,
  4  description VARCHAR2 (100)
  5  )
  6  PARTITION BY RANGE (sample_time)
  7    INTERVAL ( NUMTODSINTERVAL (&#039;1&#039;,
  8  				   &#039;DAY&#039;) )
  9    (PARTITION p1
 10  	  VALUES LESS THAN
 11  	    (TO_DATE (&#039;2011-04-01&#039;,
 12  		      &#039;YYYY-MM-DD&#039;)));

Table created.

SQL&gt; 
SQL&gt; prompt ==&gt;Check the preferences for the table
==&gt;Check the preferences for the table
SQL&gt; 
SQL&gt;   SELECT table_name,
  2  	      DBMS_STATS.get_prefs (pname   =&gt; &#039;INCREMENTAL&#039;,
  3  				    ownname =&gt; USER,
  4  				    tabname =&gt; table_name)
  5  		incremental,
  6  	      DBMS_STATS.get_prefs (pname   =&gt; &#039;GRANULARITY&#039;,
  7  				    ownname =&gt; USER,
  8  				    tabname =&gt; table_name)
  9  		granularity,
 10  	      DBMS_STATS.get_prefs (pname   =&gt; &#039;PUBLISH&#039;,
 11  				    ownname =&gt; USER,
 12  				    tabname =&gt; table_name)
 13  		publish,
 14  	      DBMS_STATS.get_prefs (pname   =&gt; &#039;ESTIMATE_PERCENT&#039;,
 15  				    ownname =&gt; USER,
 16  				    tabname =&gt; table_name)
 17  		estimate_percent
 18  	 FROM user_tables
 19  	WHERE table_name = &#039;T&#039;
 20  ORDER BY table_name;

TABLE_NAME&#124;INCREMENTAL &#124;GRANULARITY &#124;PUBLISH     &#124;ESTIMATE_PERCENT
----------&#124;------------&#124;------------&#124;------------&#124;------------------------------
T         &#124;FALSE       &#124;AUTO        &#124;TRUE        &#124;DBMS_STATS.AUTO_SAMPLE_SIZE

SQL&gt; 
SQL&gt; prompt ==&gt;Set table to use incremental stats
==&gt;Set table to use incremental stats
SQL&gt; 
SQL&gt; BEGIN
  2    DBMS_STATS.set_table_prefs (ownname =&gt; USER,
  3  				   tabname =&gt; &#039;T&#039;,
  4  				   pname   =&gt; &#039;INCREMENTAL&#039;,
  5  				   pvalue  =&gt; &#039;TRUE&#039;);
  6  END;
  7  /

PL/SQL procedure successfully completed.

SQL&gt; 
SQL&gt; prompt ==&gt;Check the preferences for the table
==&gt;Check the preferences for the table
SQL&gt; 
SQL&gt;   SELECT table_name,
  2  	      DBMS_STATS.get_prefs (pname   =&gt; &#039;INCREMENTAL&#039;,
  3  				    ownname =&gt; USER,
  4  				    tabname =&gt; table_name)
  5  		incremental,
  6  	      DBMS_STATS.get_prefs (pname   =&gt; &#039;GRANULARITY&#039;,
  7  				    ownname =&gt; USER,
  8  				    tabname =&gt; table_name)
  9  		granularity,
 10  	      DBMS_STATS.get_prefs (pname   =&gt; &#039;PUBLISH&#039;,
 11  				    ownname =&gt; USER,
 12  				    tabname =&gt; table_name)
 13  		publish,
 14  	      DBMS_STATS.get_prefs (pname   =&gt; &#039;ESTIMATE_PERCENT&#039;,
 15  				    ownname =&gt; USER,
 16  				    tabname =&gt; table_name)
 17  		estimate_percent
 18  	 FROM user_tables
 19  	WHERE table_name = &#039;T&#039;
 20  ORDER BY table_name;

TABLE_NAME&#124;INCREMENTAL &#124;GRANULARITY &#124;PUBLISH     &#124;ESTIMATE_PERCENT
----------&#124;------------&#124;------------&#124;------------&#124;------------------------------
T         &#124;TRUE        &#124;AUTO        &#124;TRUE        &#124;DBMS_STATS.AUTO_SAMPLE_SIZE

SQL&gt; 
SQL&gt; prompt ==&gt;Insert 2 rows
==&gt;Insert 2 rows
SQL&gt; 
SQL&gt; INSERT INTO t
  2  	  VALUES (1, SYSDATE - 5, &#039;A&#039;);

1 row created.

SQL&gt; 
SQL&gt; INSERT INTO t
  2  	  VALUES (2, SYSDATE - 4, &#039;A&#039;);

1 row created.

SQL&gt; 
SQL&gt; COMMIT;

Commit complete.

SQL&gt; 
SQL&gt; SELECT * FROM t;

        ID&#124;SAMPLE_TIME            &#124;DESCRIPTION
----------&#124;-----------------------&#124;------------
         1&#124;06-APR-2011 12:21:31 PM&#124;A
         2&#124;07-APR-2011 12:21:31 PM&#124;A

SQL&gt; 
SQL&gt; BEGIN
  2    DBMS_STATS.gather_table_stats (ownname	       =&gt; USER,
  3  				      tabname	       =&gt; &#039;T&#039;,
  4  				      estimate_percent =&gt; DBMS_STATS.auto_sample_size,
  5  				      method_opt       =&gt; &#039;FOR ALL COLUMNS SIZE 1&#039;,
  6  				      granularity      =&gt; &#039;AUTO&#039;,
  7  				      degree	       =&gt; 2,
  8  				      cascade	       =&gt; TRUE,
  9  				      no_invalidate    =&gt; TRUE);
 10  END;
 11  /

PL/SQL procedure successfully completed.

SQL&gt; 
SQL&gt; SELECT table_name, num_rows, last_analyzed
  2    FROM user_tables
  3   WHERE table_name = &#039;T&#039;;

TABLE_NAME&#124;  NUM_ROWS&#124;LAST_ANALYZED
----------&#124;----------&#124;-----------------------
T         &#124;         2&#124;11-APR-2011 12:21:32 PM

SQL&gt; 
SQL&gt;   SELECT table_name,
  2  	      partition_name,
  3  	      partition_position,
  4  	      num_rows,
  5  	      last_analyzed
  6  	 FROM user_tab_partitions
  7  	WHERE table_name = &#039;T&#039;
  8  ORDER BY partition_position;

TABLE_NAME&#124;PARTITION_NAME&#124;PARTITION_POSITION&#124;  NUM_ROWS&#124;LAST_ANALYZED
----------&#124;--------------&#124;------------------&#124;----------&#124;-----------------------
T         &#124;P1            &#124;                 1&#124;         0&#124;11-APR-2011 12:21:31 PM
T         &#124;SYS_P123420   &#124;                 2&#124;         1&#124;11-APR-2011 12:21:31 PM
T         &#124;SYS_P123421   &#124;                 3&#124;         1&#124;11-APR-2011 12:21:31 PM

SQL&gt; 
SQL&gt; SELECT index_name, num_rows, last_analyzed
  2    FROM user_indexes
  3   WHERE table_name = &#039;T&#039;;

INDEX_NAME&#124;  NUM_ROWS&#124;LAST_ANALYZED
----------&#124;----------&#124;-----------------------
PK_T      &#124;         2&#124;11-APR-2011 12:21:32 PM

SQL&gt; 
SQL&gt; EXEC dbms_lock.sleep(2);

PL/SQL procedure successfully completed.

SQL&gt; 
SQL&gt; prompt ==&gt;Insert 2 rows
==&gt;Insert 2 rows
SQL&gt; 
SQL&gt; INSERT INTO t
  2  	  VALUES (3, SYSDATE - 3, &#039;A&#039;);

1 row created.

SQL&gt; 
SQL&gt; INSERT INTO t
  2  	  VALUES (4, SYSDATE - 2, &#039;A&#039;);

1 row created.

SQL&gt; 
SQL&gt; COMMIT;

Commit complete.

SQL&gt; 
SQL&gt; SELECT * FROM t;

        ID&#124;SAMPLE_TIME            &#124;DESCRIPTION
----------&#124;-----------------------&#124;------------
         1&#124;06-APR-2011 12:21:31 PM&#124;A
         2&#124;07-APR-2011 12:21:31 PM&#124;A
         3&#124;08-APR-2011 12:21:34 PM&#124;A
         4&#124;09-APR-2011 12:21:34 PM&#124;A

SQL&gt; 
SQL&gt; BEGIN
  2    DBMS_STATS.gather_table_stats (ownname	       =&gt; USER,
  3  				      tabname	       =&gt; &#039;T&#039;,
  4  				      estimate_percent =&gt; DBMS_STATS.auto_sample_size,
  5  				      method_opt       =&gt; &#039;FOR ALL COLUMNS SIZE 1&#039;,
  6  				      granularity      =&gt; &#039;AUTO&#039;,
  7  				      degree	       =&gt; 2,
  8  				      cascade	       =&gt; TRUE,
  9  				      no_invalidate    =&gt; TRUE);
 10  END;
 11  /

PL/SQL procedure successfully completed.

SQL&gt; 
SQL&gt; SELECT table_name, num_rows, last_analyzed
  2    FROM user_tables
  3   WHERE table_name = &#039;T&#039;;

TABLE_NAME&#124;  NUM_ROWS&#124;LAST_ANALYZED
----------&#124;----------&#124;-----------------------
T         &#124;         4&#124;11-APR-2011 12:21:35 PM

SQL&gt; 
SQL&gt;   SELECT table_name,
  2  	      partition_name,
  3  	      partition_position,
  4  	      num_rows,
  5  	      last_analyzed
  6  	 FROM user_tab_partitions
  7  	WHERE table_name = &#039;T&#039;
  8  ORDER BY partition_position;

TABLE_NAME&#124;PARTITION_NAME&#124;PARTITION_POSITION&#124;  NUM_ROWS&#124;LAST_ANALYZED
----------&#124;--------------&#124;------------------&#124;----------&#124;-----------------------
T         &#124;P1            &#124;                 1&#124;         0&#124;11-APR-2011 12:21:31 PM
T         &#124;SYS_P123420   &#124;                 2&#124;         1&#124;11-APR-2011 12:21:34 PM
T         &#124;SYS_P123421   &#124;                 3&#124;         1&#124;11-APR-2011 12:21:34 PM
T         &#124;SYS_P123422   &#124;                 4&#124;         1&#124;11-APR-2011 12:21:34 PM
T         &#124;SYS_P123423   &#124;                 5&#124;         1&#124;11-APR-2011 12:21:34 PM

SQL&gt; 
SQL&gt; SELECT index_name, num_rows, last_analyzed
  2    FROM user_indexes
  3   WHERE table_name = &#039;T&#039;;

INDEX_NAME&#124;  NUM_ROWS&#124;LAST_ANALYZED
----------&#124;----------&#124;-----------------------
PK_T      &#124;         4&#124;11-APR-2011 12:21:35 PM

SQL&gt; 
SQL&gt; EXEC dbms_lock.sleep(2);

PL/SQL procedure successfully completed.

SQL&gt; 
SQL&gt; prompt ==&gt;No insert here, just gather stats
==&gt;No insert here, just gather stats
SQL&gt; 
SQL&gt; BEGIN
  2    DBMS_STATS.gather_table_stats (ownname	       =&gt; USER,
  3  				      tabname	       =&gt; &#039;T&#039;,
  4  				      estimate_percent =&gt; DBMS_STATS.auto_sample_size,
  5  				      method_opt       =&gt; &#039;FOR ALL COLUMNS SIZE 1&#039;,
  6  				      granularity      =&gt; &#039;AUTO&#039;,
  7  				      degree	       =&gt; 2,
  8  				      cascade	       =&gt; TRUE,
  9  				      no_invalidate    =&gt; TRUE);
 10  END;
 11  /

PL/SQL procedure successfully completed.

SQL&gt; 
SQL&gt; SELECT table_name, num_rows, last_analyzed
  2    FROM user_tables
  3   WHERE table_name = &#039;T&#039;;

TABLE_NAME&#124;  NUM_ROWS&#124;LAST_ANALYZED
----------&#124;----------&#124;-----------------------
T         &#124;         4&#124;11-APR-2011 12:21:38 PM

SQL&gt; 
SQL&gt;   SELECT table_name,
  2  	      partition_name,
  3  	      partition_position,
  4  	      num_rows,
  5  	      last_analyzed
  6  	 FROM user_tab_partitions
  7  	WHERE table_name = &#039;T&#039;
  8  ORDER BY partition_position;

TABLE_NAME&#124;PARTITION_NAME&#124;PARTITION_POSITION&#124;  NUM_ROWS&#124;LAST_ANALYZED
----------&#124;--------------&#124;------------------&#124;----------&#124;-----------------------
T         &#124;P1            &#124;                 1&#124;         0&#124;11-APR-2011 12:21:31 PM
T         &#124;SYS_P123420   &#124;                 2&#124;         1&#124;11-APR-2011 12:21:37 PM
T         &#124;SYS_P123421   &#124;                 3&#124;         1&#124;11-APR-2011 12:21:37 PM
T         &#124;SYS_P123422   &#124;                 4&#124;         1&#124;11-APR-2011 12:21:37 PM
T         &#124;SYS_P123423   &#124;                 5&#124;         1&#124;11-APR-2011 12:21:37 PM

SQL&gt; 
SQL&gt; SELECT index_name, num_rows, last_analyzed
  2    FROM user_indexes
  3   WHERE table_name = &#039;T&#039;;

INDEX_NAME&#124;  NUM_ROWS&#124;LAST_ANALYZED
----------&#124;----------&#124;-----------------------
PK_T      &#124;         4&#124;11-APR-2011 12:21:38 PM

SQL&gt; 
SQL&gt; EXEC dbms_lock.sleep(2);

PL/SQL procedure successfully completed.

SQL&gt; 
SQL&gt; prompt ==&gt;No insert here, just gather stats
==&gt;No insert here, just gather stats
SQL&gt; 
SQL&gt; BEGIN
  2    DBMS_STATS.gather_table_stats (ownname	       =&gt; USER,
  3  				      tabname	       =&gt; &#039;T&#039;,
  4  				      estimate_percent =&gt; DBMS_STATS.auto_sample_size,
  5  				      method_opt       =&gt; &#039;FOR ALL COLUMNS SIZE 1&#039;,
  6  				      granularity      =&gt; &#039;AUTO&#039;,
  7  				      degree	       =&gt; 2,
  8  				      cascade	       =&gt; TRUE,
  9  				      no_invalidate    =&gt; TRUE);
 10  END;
 11  /

PL/SQL procedure successfully completed.

SQL&gt; 
SQL&gt; SELECT table_name, num_rows, last_analyzed
  2    FROM user_tables
  3   WHERE table_name = &#039;T&#039;;

TABLE_NAME&#124;  NUM_ROWS&#124;LAST_ANALYZED
----------&#124;----------&#124;-----------------------
T         &#124;         4&#124;11-APR-2011 12:21:41 PM

SQL&gt; 
SQL&gt;   SELECT table_name,
  2  	      partition_name,
  3  	      partition_position,
  4  	      num_rows,
  5  	      last_analyzed
  6  	 FROM user_tab_partitions
  7  	WHERE table_name = &#039;T&#039;
  8  ORDER BY partition_position;

TABLE_NAME&#124;PARTITION_NAME&#124;PARTITION_POSITION&#124;  NUM_ROWS&#124;LAST_ANALYZED
----------&#124;--------------&#124;------------------&#124;----------&#124;-----------------------
T         &#124;P1            &#124;                 1&#124;         0&#124;11-APR-2011 12:21:31 PM
T         &#124;SYS_P123420   &#124;                 2&#124;         1&#124;11-APR-2011 12:21:41 PM
T         &#124;SYS_P123421   &#124;                 3&#124;         1&#124;11-APR-2011 12:21:41 PM
T         &#124;SYS_P123422   &#124;                 4&#124;         1&#124;11-APR-2011 12:21:41 PM
T         &#124;SYS_P123423   &#124;                 5&#124;         1&#124;11-APR-2011 12:21:41 PM

SQL&gt; 
SQL&gt; SELECT index_name, num_rows, last_analyzed
  2    FROM user_indexes
  3   WHERE table_name = &#039;T&#039;;

INDEX_NAME&#124;  NUM_ROWS&#124;LAST_ANALYZED
----------&#124;----------&#124;-----------------------
PK_T      &#124;         4&#124;11-APR-2011 12:21:41 PM

SQL&gt; 
SQL&gt; exit
[/sourcecode]</description>
		<content:encoded><![CDATA[<p>Here is the test case. Watch for the last_analyzed column.</p>
<pre class="brush: plain; title: ; notranslate">

SQL&gt; ALTER SESSION SET nls_date_format='DD-MON-YYYY HH12:MI:SS AM';

Session altered.

SQL&gt;
SQL&gt; DROP TABLE t PURGE;

Table dropped.

SQL&gt; prompt ==&gt;Create a partitioned table T using interval partitioning
==&gt;Create a partitioned table T using interval partitioning
SQL&gt;
SQL&gt; CREATE TABLE t (
  2  id NUMBER CONSTRAINT pk_t PRIMARY KEY,
  3  sample_time DATE,
  4  description VARCHAR2 (100)
  5  )
  6  PARTITION BY RANGE (sample_time)
  7    INTERVAL ( NUMTODSINTERVAL ('1',
  8  				   'DAY') )
  9    (PARTITION p1
 10  	  VALUES LESS THAN
 11  	    (TO_DATE ('2011-04-01',
 12  		      'YYYY-MM-DD')));

Table created.

SQL&gt;
SQL&gt; prompt ==&gt;Check the preferences for the table
==&gt;Check the preferences for the table
SQL&gt;
SQL&gt;   SELECT table_name,
  2  	      DBMS_STATS.get_prefs (pname   =&gt; 'INCREMENTAL',
  3  				    ownname =&gt; USER,
  4  				    tabname =&gt; table_name)
  5  		incremental,
  6  	      DBMS_STATS.get_prefs (pname   =&gt; 'GRANULARITY',
  7  				    ownname =&gt; USER,
  8  				    tabname =&gt; table_name)
  9  		granularity,
 10  	      DBMS_STATS.get_prefs (pname   =&gt; 'PUBLISH',
 11  				    ownname =&gt; USER,
 12  				    tabname =&gt; table_name)
 13  		publish,
 14  	      DBMS_STATS.get_prefs (pname   =&gt; 'ESTIMATE_PERCENT',
 15  				    ownname =&gt; USER,
 16  				    tabname =&gt; table_name)
 17  		estimate_percent
 18  	 FROM user_tables
 19  	WHERE table_name = 'T'
 20  ORDER BY table_name;

TABLE_NAME|INCREMENTAL |GRANULARITY |PUBLISH     |ESTIMATE_PERCENT
----------|------------|------------|------------|------------------------------
T         |FALSE       |AUTO        |TRUE        |DBMS_STATS.AUTO_SAMPLE_SIZE

SQL&gt;
SQL&gt; prompt ==&gt;Set table to use incremental stats
==&gt;Set table to use incremental stats
SQL&gt;
SQL&gt; BEGIN
  2    DBMS_STATS.set_table_prefs (ownname =&gt; USER,
  3  				   tabname =&gt; 'T',
  4  				   pname   =&gt; 'INCREMENTAL',
  5  				   pvalue  =&gt; 'TRUE');
  6  END;
  7  /

PL/SQL procedure successfully completed.

SQL&gt;
SQL&gt; prompt ==&gt;Check the preferences for the table
==&gt;Check the preferences for the table
SQL&gt;
SQL&gt;   SELECT table_name,
  2  	      DBMS_STATS.get_prefs (pname   =&gt; 'INCREMENTAL',
  3  				    ownname =&gt; USER,
  4  				    tabname =&gt; table_name)
  5  		incremental,
  6  	      DBMS_STATS.get_prefs (pname   =&gt; 'GRANULARITY',
  7  				    ownname =&gt; USER,
  8  				    tabname =&gt; table_name)
  9  		granularity,
 10  	      DBMS_STATS.get_prefs (pname   =&gt; 'PUBLISH',
 11  				    ownname =&gt; USER,
 12  				    tabname =&gt; table_name)
 13  		publish,
 14  	      DBMS_STATS.get_prefs (pname   =&gt; 'ESTIMATE_PERCENT',
 15  				    ownname =&gt; USER,
 16  				    tabname =&gt; table_name)
 17  		estimate_percent
 18  	 FROM user_tables
 19  	WHERE table_name = 'T'
 20  ORDER BY table_name;

TABLE_NAME|INCREMENTAL |GRANULARITY |PUBLISH     |ESTIMATE_PERCENT
----------|------------|------------|------------|------------------------------
T         |TRUE        |AUTO        |TRUE        |DBMS_STATS.AUTO_SAMPLE_SIZE

SQL&gt;
SQL&gt; prompt ==&gt;Insert 2 rows
==&gt;Insert 2 rows
SQL&gt;
SQL&gt; INSERT INTO t
  2  	  VALUES (1, SYSDATE - 5, 'A');

1 row created.

SQL&gt;
SQL&gt; INSERT INTO t
  2  	  VALUES (2, SYSDATE - 4, 'A');

1 row created.

SQL&gt;
SQL&gt; COMMIT;

Commit complete.

SQL&gt;
SQL&gt; SELECT * FROM t;

        ID|SAMPLE_TIME            |DESCRIPTION
----------|-----------------------|------------
         1|06-APR-2011 12:21:31 PM|A
         2|07-APR-2011 12:21:31 PM|A

SQL&gt;
SQL&gt; BEGIN
  2    DBMS_STATS.gather_table_stats (ownname	       =&gt; USER,
  3  				      tabname	       =&gt; 'T',
  4  				      estimate_percent =&gt; DBMS_STATS.auto_sample_size,
  5  				      method_opt       =&gt; 'FOR ALL COLUMNS SIZE 1',
  6  				      granularity      =&gt; 'AUTO',
  7  				      degree	       =&gt; 2,
  8  				      cascade	       =&gt; TRUE,
  9  				      no_invalidate    =&gt; TRUE);
 10  END;
 11  /

PL/SQL procedure successfully completed.

SQL&gt;
SQL&gt; SELECT table_name, num_rows, last_analyzed
  2    FROM user_tables
  3   WHERE table_name = 'T';

TABLE_NAME|  NUM_ROWS|LAST_ANALYZED
----------|----------|-----------------------
T         |         2|11-APR-2011 12:21:32 PM

SQL&gt;
SQL&gt;   SELECT table_name,
  2  	      partition_name,
  3  	      partition_position,
  4  	      num_rows,
  5  	      last_analyzed
  6  	 FROM user_tab_partitions
  7  	WHERE table_name = 'T'
  8  ORDER BY partition_position;

TABLE_NAME|PARTITION_NAME|PARTITION_POSITION|  NUM_ROWS|LAST_ANALYZED
----------|--------------|------------------|----------|-----------------------
T         |P1            |                 1|         0|11-APR-2011 12:21:31 PM
T         |SYS_P123420   |                 2|         1|11-APR-2011 12:21:31 PM
T         |SYS_P123421   |                 3|         1|11-APR-2011 12:21:31 PM

SQL&gt;
SQL&gt; SELECT index_name, num_rows, last_analyzed
  2    FROM user_indexes
  3   WHERE table_name = 'T';

INDEX_NAME|  NUM_ROWS|LAST_ANALYZED
----------|----------|-----------------------
PK_T      |         2|11-APR-2011 12:21:32 PM

SQL&gt;
SQL&gt; EXEC dbms_lock.sleep(2);

PL/SQL procedure successfully completed.

SQL&gt;
SQL&gt; prompt ==&gt;Insert 2 rows
==&gt;Insert 2 rows
SQL&gt;
SQL&gt; INSERT INTO t
  2  	  VALUES (3, SYSDATE - 3, 'A');

1 row created.

SQL&gt;
SQL&gt; INSERT INTO t
  2  	  VALUES (4, SYSDATE - 2, 'A');

1 row created.

SQL&gt;
SQL&gt; COMMIT;

Commit complete.

SQL&gt;
SQL&gt; SELECT * FROM t;

        ID|SAMPLE_TIME            |DESCRIPTION
----------|-----------------------|------------
         1|06-APR-2011 12:21:31 PM|A
         2|07-APR-2011 12:21:31 PM|A
         3|08-APR-2011 12:21:34 PM|A
         4|09-APR-2011 12:21:34 PM|A

SQL&gt;
SQL&gt; BEGIN
  2    DBMS_STATS.gather_table_stats (ownname	       =&gt; USER,
  3  				      tabname	       =&gt; 'T',
  4  				      estimate_percent =&gt; DBMS_STATS.auto_sample_size,
  5  				      method_opt       =&gt; 'FOR ALL COLUMNS SIZE 1',
  6  				      granularity      =&gt; 'AUTO',
  7  				      degree	       =&gt; 2,
  8  				      cascade	       =&gt; TRUE,
  9  				      no_invalidate    =&gt; TRUE);
 10  END;
 11  /

PL/SQL procedure successfully completed.

SQL&gt;
SQL&gt; SELECT table_name, num_rows, last_analyzed
  2    FROM user_tables
  3   WHERE table_name = 'T';

TABLE_NAME|  NUM_ROWS|LAST_ANALYZED
----------|----------|-----------------------
T         |         4|11-APR-2011 12:21:35 PM

SQL&gt;
SQL&gt;   SELECT table_name,
  2  	      partition_name,
  3  	      partition_position,
  4  	      num_rows,
  5  	      last_analyzed
  6  	 FROM user_tab_partitions
  7  	WHERE table_name = 'T'
  8  ORDER BY partition_position;

TABLE_NAME|PARTITION_NAME|PARTITION_POSITION|  NUM_ROWS|LAST_ANALYZED
----------|--------------|------------------|----------|-----------------------
T         |P1            |                 1|         0|11-APR-2011 12:21:31 PM
T         |SYS_P123420   |                 2|         1|11-APR-2011 12:21:34 PM
T         |SYS_P123421   |                 3|         1|11-APR-2011 12:21:34 PM
T         |SYS_P123422   |                 4|         1|11-APR-2011 12:21:34 PM
T         |SYS_P123423   |                 5|         1|11-APR-2011 12:21:34 PM

SQL&gt;
SQL&gt; SELECT index_name, num_rows, last_analyzed
  2    FROM user_indexes
  3   WHERE table_name = 'T';

INDEX_NAME|  NUM_ROWS|LAST_ANALYZED
----------|----------|-----------------------
PK_T      |         4|11-APR-2011 12:21:35 PM

SQL&gt;
SQL&gt; EXEC dbms_lock.sleep(2);

PL/SQL procedure successfully completed.

SQL&gt;
SQL&gt; prompt ==&gt;No insert here, just gather stats
==&gt;No insert here, just gather stats
SQL&gt;
SQL&gt; BEGIN
  2    DBMS_STATS.gather_table_stats (ownname	       =&gt; USER,
  3  				      tabname	       =&gt; 'T',
  4  				      estimate_percent =&gt; DBMS_STATS.auto_sample_size,
  5  				      method_opt       =&gt; 'FOR ALL COLUMNS SIZE 1',
  6  				      granularity      =&gt; 'AUTO',
  7  				      degree	       =&gt; 2,
  8  				      cascade	       =&gt; TRUE,
  9  				      no_invalidate    =&gt; TRUE);
 10  END;
 11  /

PL/SQL procedure successfully completed.

SQL&gt;
SQL&gt; SELECT table_name, num_rows, last_analyzed
  2    FROM user_tables
  3   WHERE table_name = 'T';

TABLE_NAME|  NUM_ROWS|LAST_ANALYZED
----------|----------|-----------------------
T         |         4|11-APR-2011 12:21:38 PM

SQL&gt;
SQL&gt;   SELECT table_name,
  2  	      partition_name,
  3  	      partition_position,
  4  	      num_rows,
  5  	      last_analyzed
  6  	 FROM user_tab_partitions
  7  	WHERE table_name = 'T'
  8  ORDER BY partition_position;

TABLE_NAME|PARTITION_NAME|PARTITION_POSITION|  NUM_ROWS|LAST_ANALYZED
----------|--------------|------------------|----------|-----------------------
T         |P1            |                 1|         0|11-APR-2011 12:21:31 PM
T         |SYS_P123420   |                 2|         1|11-APR-2011 12:21:37 PM
T         |SYS_P123421   |                 3|         1|11-APR-2011 12:21:37 PM
T         |SYS_P123422   |                 4|         1|11-APR-2011 12:21:37 PM
T         |SYS_P123423   |                 5|         1|11-APR-2011 12:21:37 PM

SQL&gt;
SQL&gt; SELECT index_name, num_rows, last_analyzed
  2    FROM user_indexes
  3   WHERE table_name = 'T';

INDEX_NAME|  NUM_ROWS|LAST_ANALYZED
----------|----------|-----------------------
PK_T      |         4|11-APR-2011 12:21:38 PM

SQL&gt;
SQL&gt; EXEC dbms_lock.sleep(2);

PL/SQL procedure successfully completed.

SQL&gt;
SQL&gt; prompt ==&gt;No insert here, just gather stats
==&gt;No insert here, just gather stats
SQL&gt;
SQL&gt; BEGIN
  2    DBMS_STATS.gather_table_stats (ownname	       =&gt; USER,
  3  				      tabname	       =&gt; 'T',
  4  				      estimate_percent =&gt; DBMS_STATS.auto_sample_size,
  5  				      method_opt       =&gt; 'FOR ALL COLUMNS SIZE 1',
  6  				      granularity      =&gt; 'AUTO',
  7  				      degree	       =&gt; 2,
  8  				      cascade	       =&gt; TRUE,
  9  				      no_invalidate    =&gt; TRUE);
 10  END;
 11  /

PL/SQL procedure successfully completed.

SQL&gt;
SQL&gt; SELECT table_name, num_rows, last_analyzed
  2    FROM user_tables
  3   WHERE table_name = 'T';

TABLE_NAME|  NUM_ROWS|LAST_ANALYZED
----------|----------|-----------------------
T         |         4|11-APR-2011 12:21:41 PM

SQL&gt;
SQL&gt;   SELECT table_name,
  2  	      partition_name,
  3  	      partition_position,
  4  	      num_rows,
  5  	      last_analyzed
  6  	 FROM user_tab_partitions
  7  	WHERE table_name = 'T'
  8  ORDER BY partition_position;

TABLE_NAME|PARTITION_NAME|PARTITION_POSITION|  NUM_ROWS|LAST_ANALYZED
----------|--------------|------------------|----------|-----------------------
T         |P1            |                 1|         0|11-APR-2011 12:21:31 PM
T         |SYS_P123420   |                 2|         1|11-APR-2011 12:21:41 PM
T         |SYS_P123421   |                 3|         1|11-APR-2011 12:21:41 PM
T         |SYS_P123422   |                 4|         1|11-APR-2011 12:21:41 PM
T         |SYS_P123423   |                 5|         1|11-APR-2011 12:21:41 PM

SQL&gt;
SQL&gt; SELECT index_name, num_rows, last_analyzed
  2    FROM user_indexes
  3   WHERE table_name = 'T';

INDEX_NAME|  NUM_ROWS|LAST_ANALYZED
----------|----------|-----------------------
PK_T      |         4|11-APR-2011 12:21:41 PM

SQL&gt;
SQL&gt; exit
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg Rahn</title>
		<link>http://structureddata.org/2008/07/16/oracle-11g-incremental-global-statistics-on-partitioned-tables/#comment-17228</link>
		<dc:creator>Greg Rahn</dc:creator>
		<pubDate>Wed, 06 Apr 2011 17:57:21 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=70#comment-17228</guid>
		<description>@DBA

Can you provide a test case that demonstrates this behavior?</description>
		<content:encoded><![CDATA[<p>@DBA</p>
<p>Can you provide a test case that demonstrates this behavior?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DBA</title>
		<link>http://structureddata.org/2008/07/16/oracle-11g-incremental-global-statistics-on-partitioned-tables/#comment-17210</link>
		<dc:creator>DBA</dc:creator>
		<pubDate>Tue, 05 Apr 2011 15:40:23 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=70#comment-17210</guid>
		<description>I tested the incremental stats feature with 11.1.0.7 version on Linux 64 bit OS. Sometimes it works, sometimes it doesn&#039;t. And the only thing I have been able to find so far is that if you have a Primary key (with a global index) on a partitioned table that is not part of the partition key (e.g. in OLTP), the incremental stats don&#039;t work. I have gathered stats on a table back to back that was set to use incremental stats. It gathered stats on all the partitions all over again the second time even when there was not a single DML that happened in between the two stat gathering. I have seen a few bugs about this on Mysupport website. Have you anything to share about this phenomenon?</description>
		<content:encoded><![CDATA[<p>I tested the incremental stats feature with 11.1.0.7 version on Linux 64 bit OS. Sometimes it works, sometimes it doesn&#8217;t. And the only thing I have been able to find so far is that if you have a Primary key (with a global index) on a partitioned table that is not part of the partition key (e.g. in OLTP), the incremental stats don&#8217;t work. I have gathered stats on a table back to back that was set to use incremental stats. It gathered stats on all the partitions all over again the second time even when there was not a single DML that happened in between the two stat gathering. I have seen a few bugs about this on Mysupport website. Have you anything to share about this phenomenon?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Data Warehousing and Statistics in Oracle 11g &#8211; incremental global statistics &#171; RNM</title>
		<link>http://structureddata.org/2008/07/16/oracle-11g-incremental-global-statistics-on-partitioned-tables/#comment-15314</link>
		<dc:creator>Data Warehousing and Statistics in Oracle 11g &#8211; incremental global statistics &#171; RNM</dc:creator>
		<pubDate>Thu, 30 Dec 2010 23:40:02 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=70#comment-15314</guid>
		<description>[...] Greg Rahn &#8211; Oracle 11g: Incremental Global
Statistics On Partitioned Tables [...]</description>
		<content:encoded><![CDATA[<p>[...] Greg Rahn &#8211; Oracle 11g: Incremental Global<br />
Statistics On Partitioned Tables [...]</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 1/3 queries in 0.001 seconds using disk: basic
Object Caching 406/407 objects using disk: basic

Served from: structureddata.org @ 2012-02-09 18:25:37 -->
