<?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: Index Hints</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2011/11/24/index-hints/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2011/11/24/index-hints/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Wed, 22 May 2013 01:50:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: kartik</title>
		<link>http://jonathanlewis.wordpress.com/2011/11/24/index-hints/#comment-45934</link>
		<dc:creator><![CDATA[kartik]]></dc:creator>
		<pubDate>Thu, 05 Apr 2012 07:13:31 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=7556#comment-45934</guid>
		<description><![CDATA[Hi Jonathan,

Which views do we need to query to find the the current running queries which are using indexes with high costs? Kindly suggest.

Thanks,
Kartik]]></description>
		<content:encoded><![CDATA[<p>Hi Jonathan,</p>
<p>Which views do we need to query to find the the current running queries which are using indexes with high costs? Kindly suggest.</p>
<p>Thanks,<br />
Kartik</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Quiz Night &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2011/11/24/index-hints/#comment-44385</link>
		<dc:creator><![CDATA[Quiz Night &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Fri, 13 Jan 2012 18:42:13 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=7556#comment-44385</guid>
		<description><![CDATA[[...] a little history recently I came across a note I&#8217;d written about the new-style index hint. In that note I claimed that:  &#8230; the index has to start with the columns (product_group, id) [...]]]></description>
		<content:encoded><![CDATA[<p>[...] a little history recently I came across a note I&#8217;d written about the new-style index hint. In that note I claimed that:  &#8230; the index has to start with the columns (product_group, id) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dom Brooks</title>
		<link>http://jonathanlewis.wordpress.com/2011/11/24/index-hints/#comment-42585</link>
		<dc:creator><![CDATA[Dom Brooks]]></dc:creator>
		<pubDate>Fri, 25 Nov 2011 10:41:04 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=7556#comment-42585</guid>
		<description><![CDATA[Indeed - definitely surprising.]]></description>
		<content:encoded><![CDATA[<p>Indeed &#8211; definitely surprising.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2011/11/24/index-hints/#comment-42584</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Fri, 25 Nov 2011 10:05:18 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=7556#comment-42584</guid>
		<description><![CDATA[Dom,

Nice comment, especially the addition of (sensible).
Thanks for that - and the follow-up.
Interestingly the same strategy fails (in 10.2.0.3) for my bitmap join index example, although it worked for a bitmap join index which was a two-table join rather than three tables 
Your example did make me think about the side effects of things like export/import, and dropping indexes, etc. 
I hope everyone noticed your comment about danger - here&#039;s a little threat waitng to happen if anyone takes that approach in production:

[sourcecode]

SQL&gt; select column_name from user_tab_cols where table_name = &#039;PEOPLE&#039;;

COLUMN_NAME
--------------------
ID_TOWN_WORK
ID_TOWN_HOME
PADDING

SQL&gt; create index pe_ho1 on people(id_town_home + 1);

Index created.

SQL&gt; select column_name from user_tab_cols where table_name = &#039;PEOPLE&#039;;

COLUMN_NAME
--------------------
ID_TOWN_WORK
ID_TOWN_HOME
PADDING
SYS_NC00004$

SQL&gt; create index pe_ho2 on people(id_town_home + 2);

Index created.

SQL&gt; select column_name from user_tab_cols where table_name = &#039;PEOPLE&#039;;

COLUMN_NAME
--------------------
ID_TOWN_WORK
ID_TOWN_HOME
PADDING
SYS_NC00004$
SYS_NC00005$

SQL&gt; drop index pe_ho1;

Index dropped.

SQL&gt; select column_name from user_tab_cols where table_name = &#039;PEOPLE&#039;;

COLUMN_NAME
--------------------
ID_TOWN_WORK
ID_TOWN_HOME
PADDING
SYS_NC00004$

[/sourcecode]

Notice how the virtual column for index &lt;strong&gt;pe_ho2 &lt;/strong&gt;starts life as &lt;strong&gt;sys_nc00005$&lt;/strong&gt;, but changes to &lt;strong&gt;sys_nc00004$&lt;/strong&gt; when you drop the index&lt;strong&gt; pe_ho1 &lt;/strong&gt;?
That surprised me - I thought I&#039;d have to use an export import pass to switch virtual columes on the indexes]]></description>
		<content:encoded><![CDATA[<p>Dom,</p>
<p>Nice comment, especially the addition of (sensible).<br />
Thanks for that &#8211; and the follow-up.<br />
Interestingly the same strategy fails (in 10.2.0.3) for my bitmap join index example, although it worked for a bitmap join index which was a two-table join rather than three tables<br />
Your example did make me think about the side effects of things like export/import, and dropping indexes, etc.<br />
I hope everyone noticed your comment about danger &#8211; here&#8217;s a little threat waitng to happen if anyone takes that approach in production:</p>
<pre class="brush: plain; title: ; notranslate">

SQL&gt; select column_name from user_tab_cols where table_name = 'PEOPLE';

COLUMN_NAME
--------------------
ID_TOWN_WORK
ID_TOWN_HOME
PADDING

SQL&gt; create index pe_ho1 on people(id_town_home + 1);

Index created.

SQL&gt; select column_name from user_tab_cols where table_name = 'PEOPLE';

COLUMN_NAME
--------------------
ID_TOWN_WORK
ID_TOWN_HOME
PADDING
SYS_NC00004$

SQL&gt; create index pe_ho2 on people(id_town_home + 2);

Index created.

SQL&gt; select column_name from user_tab_cols where table_name = 'PEOPLE';

COLUMN_NAME
--------------------
ID_TOWN_WORK
ID_TOWN_HOME
PADDING
SYS_NC00004$
SYS_NC00005$

SQL&gt; drop index pe_ho1;

Index dropped.

SQL&gt; select column_name from user_tab_cols where table_name = 'PEOPLE';

COLUMN_NAME
--------------------
ID_TOWN_WORK
ID_TOWN_HOME
PADDING
SYS_NC00004$

</pre>
<p>Notice how the virtual column for index <strong>pe_ho2 </strong>starts life as <strong>sys_nc00005$</strong>, but changes to <strong>sys_nc00004$</strong> when you drop the index<strong> pe_ho1 </strong>?<br />
That surprised me &#8211; I thought I&#8217;d have to use an export import pass to switch virtual columes on the indexes</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dom Brooks</title>
		<link>http://jonathanlewis.wordpress.com/2011/11/24/index-hints/#comment-42583</link>
		<dc:creator><![CDATA[Dom Brooks]]></dc:creator>
		<pubDate>Fri, 25 Nov 2011 09:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=7556#comment-42583</guid>
		<description><![CDATA[As expected it was the same.
Of course the danger of the hidden column name is that it might not be the same from environment to environment. So definitely not a sensible approach.]]></description>
		<content:encoded><![CDATA[<p>As expected it was the same.<br />
Of course the danger of the hidden column name is that it might not be the same from environment to environment. So definitely not a sensible approach.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dom Brooks</title>
		<link>http://jonathanlewis.wordpress.com/2011/11/24/index-hints/#comment-42581</link>
		<dc:creator><![CDATA[Dom Brooks]]></dc:creator>
		<pubDate>Fri, 25 Nov 2011 08:23:57 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=7556#comment-42581</guid>
		<description><![CDATA[I just realised that whilst going off and exploring the points you were making, I wandered away from the FBI you had with a CASE and it&#039;s possible that my FBI with NVL may be different in some way to an expression with case....]]></description>
		<content:encoded><![CDATA[<p>I just realised that whilst going off and exploring the points you were making, I wandered away from the FBI you had with a CASE and it&#8217;s possible that my FBI with NVL may be different in some way to an expression with case&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dom Brooks</title>
		<link>http://jonathanlewis.wordpress.com/2011/11/24/index-hints/#comment-42570</link>
		<dc:creator><![CDATA[Dom Brooks]]></dc:creator>
		<pubDate>Thu, 24 Nov 2011 16:43:40 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=7556#comment-42570</guid>
		<description><![CDATA[&quot;There simply is no alternative.&quot;

There is no (sensible) alternative.
i.e. could you not  use the hidden column name? 
[code]
SQL&gt; explain plan for
  2  select * 
  3  from t2 
  4  where nvl(col1,1) &gt; 0;

Explained.

SQL&gt; 
SQL&gt; select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------
Plan hash value: 1513984157

--------------------------------------------------------------------------
&#124; Id  &#124; Operation         &#124; Name &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
--------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT  &#124;      &#124; 10000 &#124; 80000 &#124;     9  (12)&#124; 00:00:01 &#124;
&#124;*  1 &#124;  TABLE ACCESS FULL&#124; T2   &#124; 10000 &#124; 80000 &#124;     9  (12)&#124; 00:00:01 &#124;
--------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter(NVL(&quot;COL1&quot;,1)&gt;0)

13 rows selected.

SQL&gt; 
SQL&gt; explain plan for
  2  select /*+
  3           index(@&quot;SEL$1&quot; &quot;T2&quot;@&quot;SEL$1&quot; (&quot;T2&quot;.&quot;SYS_NC00002$&quot;)) 
  4           */ 
  5         * 
  6  from t2 
  7  where nvl(col1,1) &gt; 0;

Explained.

SQL&gt; 
SQL&gt; select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------
Plan hash value: 3246639252

------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                   &#124; Name &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT            &#124;      &#124; 10000 &#124; 80000 &#124;    38   (3)&#124; 00:00:01 &#124;
&#124;   1 &#124;  TABLE ACCESS BY INDEX ROWID&#124; T2   &#124; 10000 &#124; 80000 &#124;    38   (3)&#124; 00:00:01 &#124;
&#124;*  2 &#124;   INDEX RANGE SCAN          &#124; I_T2 &#124; 10000 &#124;       &#124;    22   (5)&#124; 00:00:01 &#124;
------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access(NVL(&quot;COL1&quot;,1)&gt;0)

14 rows selected.

SQL&gt; 
[/code]]]></description>
		<content:encoded><![CDATA[<p>&#8220;There simply is no alternative.&#8221;</p>
<p>There is no (sensible) alternative.<br />
i.e. could you not  use the hidden column name? </p>
<pre class="brush: plain; title: ; notranslate">
SQL&gt; explain plan for
  2  select * 
  3  from t2 
  4  where nvl(col1,1) &gt; 0;

Explained.

SQL&gt; 
SQL&gt; select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------
Plan hash value: 1513984157

--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      | 10000 | 80000 |     9  (12)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| T2   | 10000 | 80000 |     9  (12)| 00:00:01 |
--------------------------------------------------------------------------

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

   1 - filter(NVL(&quot;COL1&quot;,1)&gt;0)

13 rows selected.

SQL&gt; 
SQL&gt; explain plan for
  2  select /*+
  3           index(@&quot;SEL$1&quot; &quot;T2&quot;@&quot;SEL$1&quot; (&quot;T2&quot;.&quot;SYS_NC00002$&quot;)) 
  4           */ 
  5         * 
  6  from t2 
  7  where nvl(col1,1) &gt; 0;

Explained.

SQL&gt; 
SQL&gt; select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------
Plan hash value: 3246639252

------------------------------------------------------------------------------------
| Id  | Operation                   | Name | Rows  | Bytes | Cost (%CPU)| Time     |
------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |      | 10000 | 80000 |    38   (3)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| T2   | 10000 | 80000 |    38   (3)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN          | I_T2 | 10000 |       |    22   (5)| 00:00:01 |
------------------------------------------------------------------------------------

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

   2 - access(NVL(&quot;COL1&quot;,1)&gt;0)

14 rows selected.

SQL&gt; 
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sid</title>
		<link>http://jonathanlewis.wordpress.com/2011/11/24/index-hints/#comment-42569</link>
		<dc:creator><![CDATA[Sid]]></dc:creator>
		<pubDate>Thu, 24 Nov 2011 15:21:23 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=7556#comment-42569</guid>
		<description><![CDATA[From the outline data, the old methed is used: index_rs_asc(@sel$1,production_information@sel$1,prd_virt)

I guess because the index type is function-base]]></description>
		<content:encoded><![CDATA[<p>From the outline data, the old methed is used: index_rs_asc(@sel$1,production_information@sel$1,prd_virt)</p>
<p>I guess because the index type is function-base</p>
]]></content:encoded>
	</item>
</channel>
</rss>
