<?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: Stale Stats</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2013/01/01/stale-stats/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2013/01/01/stale-stats/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Mon, 20 May 2013 17:10:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Simple scripts &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2013/01/01/stale-stats/#comment-52540</link>
		<dc:creator><![CDATA[Simple scripts &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Sat, 05 Jan 2013 10:09:31 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=10222#comment-52540</guid>
		<description><![CDATA[[...] Similar to &#8220;drawing an index&#8221;, but listing just the branch blocks in index order. Stale Stats: A simple piece of pl/sql to report objects with stale or missing [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Similar to &#8220;drawing an index&#8221;, but listing just the branch blocks in index order. Stale Stats: A simple piece of pl/sql to report objects with stale or missing [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: savvinov</title>
		<link>http://jonathanlewis.wordpress.com/2013/01/01/stale-stats/#comment-52489</link>
		<dc:creator><![CDATA[savvinov]]></dc:creator>
		<pubDate>Thu, 03 Jan 2013 08:41:47 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=10222#comment-52489</guid>
		<description><![CDATA[Thanks Jonathan.]]></description>
		<content:encoded><![CDATA[<p>Thanks Jonathan.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: savvinov</title>
		<link>http://jonathanlewis.wordpress.com/2013/01/01/stale-stats/#comment-52488</link>
		<dc:creator><![CDATA[savvinov]]></dc:creator>
		<pubDate>Thu, 03 Jan 2013 08:23:28 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=10222#comment-52488</guid>
		<description><![CDATA[Hi Sayan,

I agree that this method has many drawbacks, it&#039;s just that I wasn&#039;t aware of all the alternatives. It looks like that USER_TAB_MODIFICATIONS is the best way available (provided that database monitoring info was flushed recently).

Thanks!]]></description>
		<content:encoded><![CDATA[<p>Hi Sayan,</p>
<p>I agree that this method has many drawbacks, it&#8217;s just that I wasn&#8217;t aware of all the alternatives. It looks like that USER_TAB_MODIFICATIONS is the best way available (provided that database monitoring info was flushed recently).</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2013/01/01/stale-stats/#comment-52487</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Thu, 03 Jan 2013 07:06:30 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=10222#comment-52487</guid>
		<description><![CDATA[Guest,

Thanks for that.
I like your use of the obj_filter_list (available only in 11g, I believe). I didn&#039;t think of that in my version.
I wrote a version with a couple of default values and a check on the options - otherwise very similar.]]></description>
		<content:encoded><![CDATA[<p>Guest,</p>
<p>Thanks for that.<br />
I like your use of the obj_filter_list (available only in 11g, I believe). I didn&#8217;t think of that in my version.<br />
I wrote a version with a couple of default values and a check on the options &#8211; otherwise very similar.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guest</title>
		<link>http://jonathanlewis.wordpress.com/2013/01/01/stale-stats/#comment-52469</link>
		<dc:creator><![CDATA[Guest]]></dc:creator>
		<pubDate>Wed, 02 Jan 2013 15:17:17 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=10222#comment-52469</guid>
		<description><![CDATA[[sourcecode language=&quot;sql&quot; wraplines=&quot;false&quot; collapse=&quot;false&quot;]
CREATE OR REPLACE FUNCTION stats_required (i_option   IN VARCHAR2,
                                           i_user     IN VARCHAR2)
   RETURN DBMS_STATS.objecttab
   PIPELINED
AS
   /*
    This function uses autonomous transaction pragma to avoid: ORA-04092: cannot COMMIT in a trigger
   */
   PRAGMA AUTONOMOUS_TRANSACTION;
   l_object_list   DBMS_STATS.objecttab;
   filter_list     DBMS_STATS.objecttab := DBMS_STATS.objecttab ();
BEGIN
   filter_list.EXTEND (1);
   filter_list (1).objtype   := &#039;TABLE&#039;;

   DBMS_STATS.gather_schema_stats (ownname           =&gt; i_user,
                                   options           =&gt; i_option,
                                   objlist           =&gt; l_object_list,
                                   obj_filter_list   =&gt; filter_list);

   FOR i IN 1 .. l_object_list.COUNT
   LOOP
      PIPE ROW (l_object_list (i));
   END LOOP;

   RETURN;
END stats_required;
/
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<pre class="brush: sql; collapse: false; title: ; wrap-lines: false; notranslate">
CREATE OR REPLACE FUNCTION stats_required (i_option   IN VARCHAR2,
                                           i_user     IN VARCHAR2)
   RETURN DBMS_STATS.objecttab
   PIPELINED
AS
   /*
    This function uses autonomous transaction pragma to avoid: ORA-04092: cannot COMMIT in a trigger
   */
   PRAGMA AUTONOMOUS_TRANSACTION;
   l_object_list   DBMS_STATS.objecttab;
   filter_list     DBMS_STATS.objecttab := DBMS_STATS.objecttab ();
BEGIN
   filter_list.EXTEND (1);
   filter_list (1).objtype   := 'TABLE';

   DBMS_STATS.gather_schema_stats (ownname           =&gt; i_user,
                                   options           =&gt; i_option,
                                   objlist           =&gt; l_object_list,
                                   obj_filter_list   =&gt; filter_list);

   FOR i IN 1 .. l_object_list.COUNT
   LOOP
      PIPE ROW (l_object_list (i));
   END LOOP;

   RETURN;
END stats_required;
/
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2013/01/01/stale-stats/#comment-52467</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 02 Jan 2013 14:01:10 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=10222#comment-52467</guid>
		<description><![CDATA[Jared,

Give it a few more hours for the effects of new year&#039;s celebrations to wear off, and someone&#039;s sure to succumb to temptation.  (If not, I&#039;ll do it this evening.)
]]></description>
		<content:encoded><![CDATA[<p>Jared,</p>
<p>Give it a few more hours for the effects of new year&#8217;s celebrations to wear off, and someone&#8217;s sure to succumb to temptation.  (If not, I&#8217;ll do it this evening.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jared</title>
		<link>http://jonathanlewis.wordpress.com/2013/01/01/stale-stats/#comment-52456</link>
		<dc:creator><![CDATA[Jared]]></dc:creator>
		<pubDate>Wed, 02 Jan 2013 01:13:22 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=10222#comment-52456</guid>
		<description><![CDATA[Gee, I was really hoping someone else would have pipelined this by now.  :)]]></description>
		<content:encoded><![CDATA[<p>Gee, I was really hoping someone else would have pipelined this by now.  :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sayan Malakshinov</title>
		<link>http://jonathanlewis.wordpress.com/2013/01/01/stale-stats/#comment-52455</link>
		<dc:creator><![CDATA[Sayan Malakshinov]]></dc:creator>
		<pubDate>Tue, 01 Jan 2013 23:56:25 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=10222#comment-52455</guid>
		<description><![CDATA[Yes, it would be really great!]]></description>
		<content:encoded><![CDATA[<p>Yes, it would be really great!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2013/01/01/stale-stats/#comment-52448</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Tue, 01 Jan 2013 20:32:30 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=10222#comment-52448</guid>
		<description><![CDATA[One of the things I&#039;m not so keen on with the *_tab_modifications views is that it&#039;s often the case that a large fraction of the updates you do are on columns which aren&#039;t likely to be used in where clauses. Along with being able to set table-level preferences for what percentage change constitutes stale, it would be nice if we could specify which actions (inserts, updates, deletes) should be considered as relevant.  (Count them all to keep the in-memory code easy, but have three flags decoded when deciding on staleness).]]></description>
		<content:encoded><![CDATA[<p>One of the things I&#8217;m not so keen on with the *_tab_modifications views is that it&#8217;s often the case that a large fraction of the updates you do are on columns which aren&#8217;t likely to be used in where clauses. Along with being able to set table-level preferences for what percentage change constitutes stale, it would be nice if we could specify which actions (inserts, updates, deletes) should be considered as relevant.  (Count them all to keep the in-memory code easy, but have three flags decoded when deciding on staleness).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2013/01/01/stale-stats/#comment-52447</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Tue, 01 Jan 2013 20:27:56 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=10222#comment-52447</guid>
		<description><![CDATA[Owen,

Depending on the version of Oracle the underlying tables aren&#039;t necessarily updated in a timely fashion, so you have to remember to call the procedure to flushing monitoring info before querying the views (Randolf Geist supplies the name of the procedure this in &lt;a href=&quot;https://forums.oracle.com/forums/thread.jspa?messageID=10769986#10769986&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;&lt;strong&gt;his comment on the thread&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt;). There are also a few gaps - for example the stats on a nested table need to be collected separately from the stats on the parent table (unless I&#039;ve missed another new option somewhere). user_tab_statistics doesn&#039;t report nested tables at all - the call to &quot;list stale&quot; can. 

Apart from that I&#039;d simply forgotten to keep up to date with the various new columns and procedures that appear with monotonous regularity with Oracle upgrades and leave you doing things the hard way instead of using the new, easy way. (Although the new easy way sometimes isn&#039;t quite as easy to get right as one hopes.)]]></description>
		<content:encoded><![CDATA[<p>Owen,</p>
<p>Depending on the version of Oracle the underlying tables aren&#8217;t necessarily updated in a timely fashion, so you have to remember to call the procedure to flushing monitoring info before querying the views (Randolf Geist supplies the name of the procedure this in <a href="https://forums.oracle.com/forums/thread.jspa?messageID=10769986#10769986" rel="nofollow"><em><strong>his comment on the thread</strong></em></a>). There are also a few gaps &#8211; for example the stats on a nested table need to be collected separately from the stats on the parent table (unless I&#8217;ve missed another new option somewhere). user_tab_statistics doesn&#8217;t report nested tables at all &#8211; the call to &#8220;list stale&#8221; can. </p>
<p>Apart from that I&#8217;d simply forgotten to keep up to date with the various new columns and procedures that appear with monotonous regularity with Oracle upgrades and leave you doing things the hard way instead of using the new, easy way. (Although the new easy way sometimes isn&#8217;t quite as easy to get right as one hopes.)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
