<?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: Zero-Size Unusable Indexes and the Query Optimizer</title>
	<atom:link href="http://antognini.ch/2009/11/zero-size-unusable-indexes-and-the-query-optimizer/feed/" rel="self" type="application/rss+xml" />
	<link>http://antognini.ch/2009/11/zero-size-unusable-indexes-and-the-query-optimizer/</link>
	<description></description>
	<lastBuildDate>Fri, 27 Jan 2012 07:31:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: How to gain space on indexes of HCC partitioned tables &#124; ocpdba oracle weblog</title>
		<link>http://antognini.ch/2009/11/zero-size-unusable-indexes-and-the-query-optimizer/comment-page-1/#comment-29487</link>
		<dc:creator>How to gain space on indexes of HCC partitioned tables &#124; ocpdba oracle weblog</dc:creator>
		<pubDate>Thu, 30 Jun 2011 00:20:58 +0000</pubDate>
		<guid isPermaLink="false">http://antognini.ch/?p=760#comment-29487</guid>
		<description>[...] googling a bit and browsing the Oracle docs, it turned out that a blog post explaining how to implement Ghassan&#8217;s idea  already existed. It&#8217;s from Christian [...]</description>
		<content:encoded><![CDATA[<p>[...] googling a bit and browsing the Oracle docs, it turned out that a blog post explaining how to implement Ghassan&#8217;s idea  already existed. It&#8217;s from Christian [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian Antognini</title>
		<link>http://antognini.ch/2009/11/zero-size-unusable-indexes-and-the-query-optimizer/comment-page-1/#comment-8044</link>
		<dc:creator>Christian Antognini</dc:creator>
		<pubDate>Sun, 28 Feb 2010 15:02:42 +0000</pubDate>
		<guid isPermaLink="false">http://antognini.ch/?p=760#comment-8044</guid>
		<description>Hi Sachin

Sorry, but:
- I do not understand what the aim of your query is
- The query does not containt an OR and, probably for that reason, to me it seems that such an execution plan cannot be generated based on the query you provided.

BTW, the PARTITION RANGE OR is a new kind of partition pruning that is available as of 11g. It is used when, in the WHERE clause, there are several restrictions on the partition key that are connected by an OR. Up to 10g such a query would lead to a FTS.

HTH
Chris

PS: I edited you comment to make it more readable</description>
		<content:encoded><![CDATA[<p>Hi Sachin</p>
<p>Sorry, but:<br />
- I do not understand what the aim of your query is<br />
- The query does not containt an OR and, probably for that reason, to me it seems that such an execution plan cannot be generated based on the query you provided.</p>
<p>BTW, the PARTITION RANGE OR is a new kind of partition pruning that is available as of 11g. It is used when, in the WHERE clause, there are several restrictions on the partition key that are connected by an OR. Up to 10g such a query would lead to a FTS.</p>
<p>HTH<br />
Chris</p>
<p>PS: I edited you comment to make it more readable</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sachin Butala</title>
		<link>http://antognini.ch/2009/11/zero-size-unusable-indexes-and-the-query-optimizer/comment-page-1/#comment-7824</link>
		<dc:creator>Sachin Butala</dc:creator>
		<pubDate>Thu, 18 Feb 2010 07:27:26 +0000</pubDate>
		<guid isPermaLink="false">http://antognini.ch/?p=760#comment-7824</guid>
		<description>i used &quot;OR&quot; instead or &quot;BETWEEN&quot; and got different results. 
i run this test on oracle11gR2 - Solaris 10

&lt;pre&gt;SELECT count(d)
FROM t
WHERE 
((
         d &gt;= to_date(&#039;2009-12-01 01:00:00&#039;,&#039;yyyy-mm-dd hh24:mi:ss&#039;)
     and d = to_date(&#039;2009-12-01 05:00:00&#039;,&#039;yyyy-mm-dd hh24:mi:ss&#039;)
     and d &lt;= to_date(&#039;2009-12-01 06:00:00&#039;,&#039;yyyy-mm-dd hh24:mi:ss&#039;)
));
    
&#124; Id  &#124; Operation           &#124; Name &#124; Pstart&#124; Pstop &#124;
----------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT    &#124;      &#124;       &#124;       &#124;
&#124;   1 &#124;  SORT AGGREGATE     &#124;      &#124;       &#124;       &#124;
&#124;   2 &#124;   PARTITION RANGE OR&#124;      &#124;KEY(OR)&#124;KEY(OR)&#124;
&#124;   3 &#124;    TABLE ACCESS FULL&#124; T    &#124;KEY(OR)&#124;KEY(OR)&#124;
----------------------------------------------------&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>i used &#8220;OR&#8221; instead or &#8220;BETWEEN&#8221; and got different results.<br />
i run this test on oracle11gR2 &#8211; Solaris 10</p>
<p><pre>SELECT count(d)
FROM t
WHERE 
((
         d &gt;= to_date(&#039;2009-12-01 01:00:00&#039;,&#039;yyyy-mm-dd hh24:mi:ss&#039;)
     and d = to_date(&#039;2009-12-01 05:00:00&#039;,&#039;yyyy-mm-dd hh24:mi:ss&#039;)
     and d &lt;= to_date(&#039;2009-12-01 06:00:00&#039;,&#039;yyyy-mm-dd hh24:mi:ss&#039;)
));
    
| Id  | Operation           | Name | Pstart| Pstop |
----------------------------------------------------
|   0 | SELECT STATEMENT    |      |       |       |
|   1 |  SORT AGGREGATE     |      |       |       |
|   2 |   PARTITION RANGE OR|      |KEY(OR)|KEY(OR)|
|   3 |    TABLE ACCESS FULL| T    |KEY(OR)|KEY(OR)|
----------------------------------------------------</pre></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian Antognini</title>
		<link>http://antognini.ch/2009/11/zero-size-unusable-indexes-and-the-query-optimizer/comment-page-1/#comment-6961</link>
		<dc:creator>Christian Antognini</dc:creator>
		<pubDate>Mon, 11 Jan 2010 18:21:41 +0000</pubDate>
		<guid isPermaLink="false">http://antognini.ch/?p=760#comment-6961</guid>
		<description>Hi Todor

&gt; could we still make slected index partitions unusable?

Yes

&gt; if yes – what about the inserts? Can we still insert into the table partitions with usable index?

Yes and no. In fact, it is only possible to insert data in partitions that are not in unusable state.

Cheers,
Chris</description>
		<content:encoded><![CDATA[<p>Hi Todor</p>
<p>> could we still make slected index partitions unusable?</p>
<p>Yes</p>
<p>> if yes – what about the inserts? Can we still insert into the table partitions with usable index?</p>
<p>Yes and no. In fact, it is only possible to insert data in partitions that are not in unusable state.</p>
<p>Cheers,<br />
Chris</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Todor Botev</title>
		<link>http://antognini.ch/2009/11/zero-size-unusable-indexes-and-the-query-optimizer/comment-page-1/#comment-6492</link>
		<dc:creator>Todor Botev</dc:creator>
		<pubDate>Mon, 21 Dec 2009 08:30:47 +0000</pubDate>
		<guid isPermaLink="false">http://antognini.ch/?p=760#comment-6492</guid>
		<description>What if the index is there to support PK or UK:

 - could we still make slected index partitions unusable?

 - if yes - what about the inserts? Can we still insert into the table partitions with usable index?</description>
		<content:encoded><![CDATA[<p>What if the index is there to support PK or UK:</p>
<p> &#8211; could we still make slected index partitions unusable?</p>
<p> &#8211; if yes &#8211; what about the inserts? Can we still insert into the table partitions with usable index?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Partition Indexing &#171; Oracle Scratchpad</title>
		<link>http://antognini.ch/2009/11/zero-size-unusable-indexes-and-the-query-optimizer/comment-page-1/#comment-6421</link>
		<dc:creator>Partition Indexing &#171; Oracle Scratchpad</dc:creator>
		<pubDate>Thu, 17 Dec 2009 21:03:08 +0000</pubDate>
		<guid isPermaLink="false">http://antognini.ch/?p=760#comment-6421</guid>
		<description>[...] I&#8217;m guessing has been created to address this issue. Christian Antognini introduces it in this posting &#8211; which is actually starts by talking about zero-sized segments and unusable indexes.    [...]</description>
		<content:encoded><![CDATA[<p>[...] I&#8217;m guessing has been created to address this issue. Christian Antognini introduces it in this posting &#8211; which is actually starts by talking about zero-sized segments and unusable indexes.    [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://antognini.ch/2009/11/zero-size-unusable-indexes-and-the-query-optimizer/comment-page-1/#comment-6410</link>
		<dc:creator>Jonathan Lewis</dc:creator>
		<pubDate>Thu, 17 Dec 2009 12:59:36 +0000</pubDate>
		<guid isPermaLink="false">http://antognini.ch/?p=760#comment-6410</guid>
		<description>This is a nice touch, of course, for all those system which use range partitioning to &quot;age&quot; their data and want to have one set of indexes for the recent data and another set for the old data. You just have to be careful to let people know where the boundaries are, and make sure that lots of unusable partitions don&#039;t get rebuilt by accident.</description>
		<content:encoded><![CDATA[<p>This is a nice touch, of course, for all those system which use range partitioning to &#8220;age&#8221; their data and want to have one set of indexes for the recent data and another set for the old data. You just have to be careful to let people know where the boundaries are, and make sure that lots of unusable partitions don&#8217;t get rebuilt by accident.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Blogroll Report 20/11/2009-27/11/2009 &#171; Coskan&#8217;s Approach to Oracle</title>
		<link>http://antognini.ch/2009/11/zero-size-unusable-indexes-and-the-query-optimizer/comment-page-1/#comment-6310</link>
		<dc:creator>Blogroll Report 20/11/2009-27/11/2009 &#171; Coskan&#8217;s Approach to Oracle</dc:creator>
		<pubDate>Sat, 12 Dec 2009 19:05:27 +0000</pubDate>
		<guid isPermaLink="false">http://antognini.ch/?p=760#comment-6310</guid>
		<description>[...] 15-How does zero size unusable indexes affect execution plans ? Christian Antognini-Zero-Size Unusable Indexes and the Query Optimizer [...]</description>
		<content:encoded><![CDATA[<p>[...] 15-How does zero size unusable indexes affect execution plans ? Christian Antognini-Zero-Size Unusable Indexes and the Query Optimizer [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian Antognini</title>
		<link>http://antognini.ch/2009/11/zero-size-unusable-indexes-and-the-query-optimizer/comment-page-1/#comment-6065</link>
		<dc:creator>Christian Antognini</dc:creator>
		<pubDate>Thu, 26 Nov 2009 06:07:38 +0000</pubDate>
		<guid isPermaLink="false">http://antognini.ch/?p=760#comment-6065</guid>
		<description>Hi Dion

Yes, table expansion is related to it. For example, when tracing the query optimizer work with event 10053 the information related to this feature is reported in the &quot;sections&quot; of table expansion (search for &quot;TE:&quot;). Among others, the query after the transformation is given.

About the limitation... As I wrote, in this specific case I was not able to make it generate a UNION ALL with three SELECTs. It might be that in other case it works... Honestly, I didn&#039;t spent much time on it. But, again, in this case it doesn&#039;t work and, IMO, there is no good reason for it. In fact, when I run the query with the following ranges it works as expected:
- 2009-10-30 23:00:00 - 2009-11-30 23:59:59
- 2009-11-01 00:00:00 - 2009-12-01 01:00:00
Also from a cost point of view it makes no sense what the query optimizer do. In fact, in this case, the index range scan costs 2 and the full partition scan costs 68. When table expansion happens, the total cost is simply the sum of the two (70). However, when I run the query covering three partitions the resulting cost is 200! So, much higher than 2+68+2 ;-)

Anyway, in practice I don&#039;t think that this limitation will be relevant.

Cheers,
Chris</description>
		<content:encoded><![CDATA[<p>Hi Dion</p>
<p>Yes, table expansion is related to it. For example, when tracing the query optimizer work with event 10053 the information related to this feature is reported in the &#8220;sections&#8221; of table expansion (search for &#8220;TE:&#8221;). Among others, the query after the transformation is given.</p>
<p>About the limitation&#8230; As I wrote, in this specific case I was not able to make it generate a UNION ALL with three SELECTs. It might be that in other case it works&#8230; Honestly, I didn&#8217;t spent much time on it. But, again, in this case it doesn&#8217;t work and, IMO, there is no good reason for it. In fact, when I run the query with the following ranges it works as expected:<br />
- 2009-10-30 23:00:00 &#8211; 2009-11-30 23:59:59<br />
- 2009-11-01 00:00:00 &#8211; 2009-12-01 01:00:00<br />
Also from a cost point of view it makes no sense what the query optimizer do. In fact, in this case, the index range scan costs 2 and the full partition scan costs 68. When table expansion happens, the total cost is simply the sum of the two (70). However, when I run the query covering three partitions the resulting cost is 200! So, much higher than 2+68+2 ;-)</p>
<p>Anyway, in practice I don&#8217;t think that this limitation will be relevant.</p>
<p>Cheers,<br />
Chris</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dion Cho</title>
		<link>http://antognini.ch/2009/11/zero-size-unusable-indexes-and-the-query-optimizer/comment-page-1/#comment-6064</link>
		<dc:creator>Dion Cho</dc:creator>
		<pubDate>Thu, 26 Nov 2009 03:41:09 +0000</pubDate>
		<guid isPermaLink="false">http://antognini.ch/?p=760#comment-6064</guid>
		<description>Chris. Thanks for sharing valueable test cases.

This behavior seems to controlled by the new hidden parameter &quot;_optimizer_table_expansion&quot;. Table expansion makes it possible to expand the predicates spanning multiple partitions into the UNION ALL version of the query.

And my simple test case showed that the table expansion works with no problem even with the middle local index partition disabled. Your case would be the result of cost based query transformation which would have determined that expanded query is more costly. 

Cheers.</description>
		<content:encoded><![CDATA[<p>Chris. Thanks for sharing valueable test cases.</p>
<p>This behavior seems to controlled by the new hidden parameter &#8220;_optimizer_table_expansion&#8221;. Table expansion makes it possible to expand the predicates spanning multiple partitions into the UNION ALL version of the query.</p>
<p>And my simple test case showed that the table expansion works with no problem even with the middle local index partition disabled. Your case would be the result of cost based query transformation which would have determined that expanded query is more costly. </p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

