<?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: Fixing Bad Index Hints in SQL Profiles (automatically)</title>
	<atom:link href="http://kerryosborne.oracle-guy.com/2009/11/fixing-bad-index-hints-in-sql-profiles-automatically/feed/" rel="self" type="application/rss+xml" />
	<link>http://kerryosborne.oracle-guy.com/2009/11/fixing-bad-index-hints-in-sql-profiles-automatically/</link>
	<description>Just another Oracle blog</description>
	<lastBuildDate>Mon, 06 Feb 2012 21:28:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: osborne</title>
		<link>http://kerryosborne.oracle-guy.com/2009/11/fixing-bad-index-hints-in-sql-profiles-automatically/#comment-80775</link>
		<dc:creator>osborne</dc:creator>
		<pubDate>Tue, 03 Jan 2012 21:38:45 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1989#comment-80775</guid>
		<description>Damn it, I guess I&#039;m going to have start reading the documentation. And as you predicted the index did not get picked up because of the hint. I have corrected the syntax in the original post.

http://docs.oracle.com/cd/E11882_01/server.112/e26088/img/index_hint.gif

Kerry</description>
		<content:encoded><![CDATA[<p>Damn it, I guess I&#8217;m going to have start reading the documentation. And as you predicted the index did not get picked up because of the hint. I have corrected the syntax in the original post.</p>
<p><a href="http://docs.oracle.com/cd/E11882_01/server.112/e26088/img/index_hint.gif" rel="nofollow">http://docs.oracle.com/cd/E11882_01/server.112/e26088/img/index_hint.gif</a></p>
<p>Kerry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony Hasler</title>
		<link>http://kerryosborne.oracle-guy.com/2009/11/fixing-bad-index-hints-in-sql-profiles-automatically/#comment-80730</link>
		<dc:creator>Tony Hasler</dc:creator>
		<pubDate>Tue, 03 Jan 2012 18:25:25 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1989#comment-80730</guid>
		<description>Kerry,

Hint syntax is descrribed in the SQL reference manual.  For example, the syntax for specifying an index hint is here:

http://docs.oracle.com/cd/E11882_01/server.112/e26088/sql_elements006.htm#BABEFDFC

As you can see, the query block specification is optional but the table specification is not.  I have been unable to get your syntax to work on 10g or 11g.  Are you sure that the use of the index in your example isn&#039;t purely coincidental?</description>
		<content:encoded><![CDATA[<p>Kerry,</p>
<p>Hint syntax is descrribed in the SQL reference manual.  For example, the syntax for specifying an index hint is here:</p>
<p><a href="http://docs.oracle.com/cd/E11882_01/server.112/e26088/sql_elements006.htm#BABEFDFC" rel="nofollow">http://docs.oracle.com/cd/E11882_01/server.112/e26088/sql_elements006.htm#BABEFDFC</a></p>
<p>As you can see, the query block specification is optional but the table specification is not.  I have been unable to get your syntax to work on 10g or 11g.  Are you sure that the use of the index in your example isn&#8217;t purely coincidental?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: osborne</title>
		<link>http://kerryosborne.oracle-guy.com/2009/11/fixing-bad-index-hints-in-sql-profiles-automatically/#comment-80702</link>
		<dc:creator>osborne</dc:creator>
		<pubDate>Tue, 03 Jan 2012 15:48:51 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1989#comment-80702</guid>
		<description>Hi Tony,

  Thanks for the comment. Hint syntax is a bit confusing (and not really documented anywhere that I&#039;m aware of - at least with a formal syntax diagram of list of arguments). Jonathan and I were using the less formal hint syntax which leaves out the 1st and 2nd arguments (Query_Block and Alias). This is commonly done when adding hints directly to SQL statements. So the common version of the new INDEX hint syntax would look like this:

/*+ INDEX(TABLE_NAME.COLUMN_NAME TABLE_NAME.COLUMN_NAME) */

If in fact you use this format it works fine but it will be applied within the scope of the current QB. Here&#039;s an example:

&lt;pre&gt;

SYS@dbm1&gt; select /*+ index(skew.col1 skew.col2) */ count(col1) from kso.skew t  where col1 = 1 and col2 = &#039;asddsadasd&#039;;

 COUNT(COL1)
------------
     3199977

1 row selected.

Elapsed: 00:00:07.08
SYS@dbm1&gt; @x

PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  3v5nxcb4nnwga, child number 0
-------------------------------------
select /*+ index(skew.col1 skew.col2) */ count(col1) from kso.skew t
where col1 = 1 and col2 = &#039;asddsadasd&#039;

Plan hash value: 4272108972

-----------------------------------------------------
&#124; Id  &#124; Operation         &#124; Name           &#124; E-Rows &#124;
-----------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT  &#124;                &#124;        &#124;
&#124;   1 &#124;  SORT AGGREGATE   &#124;                &#124;      1 &#124;
&#124;*  2 &#124;   INDEX RANGE SCAN&#124; SKEW_COL1_COL2 &#124;      1 &#124;
-----------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access(&quot;COL1&quot;=1 AND &quot;COL2&quot;=&#039;asddsadasd&#039;)

Note
-----
   - Warning: basic plan statistics not available. These are only collected when:
       * hint &#039;gather_plan_statistics&#039; is used for the statement or
       * parameter &#039;statistics_level&#039; is set to &#039;ALL&#039;, at session or system level


26 rows selected.

Elapsed: 00:00:00.02
SYS@dbm1&gt; @sql_hints
Enter value for sql_id: 3v5nxcb4nnwga
Enter value for child_no: 0

OUTLINE_HINTS
-----------------------------------------------------------------------------------------------------------------------------------------------------------
IGNORE_OPTIM_EMBEDDED_HINTS
OPTIMIZER_FEATURES_ENABLE(&#039;11.2.0.2&#039;)
DB_VERSION(&#039;11.2.0.2&#039;)
OPT_PARAM(&#039;_optimizer_use_feedback&#039; &#039;false&#039;)
ALL_ROWS
OUTLINE_LEAF(@&quot;SEL$1&quot;)
INDEX(@&quot;SEL$1&quot; &quot;T&quot;@&quot;SEL$1&quot; (&quot;SKEW&quot;.&quot;COL1&quot; &quot;SKEW&quot;.&quot;COL2&quot;))

7 rows selected.

Elapsed: 00:00:01.05

&lt;/pre&gt;

So as you can see, the fully specified hint ends up looking like INDEX(QB_NAME ALIAS (TABLE_NAME.COLUMN_NAME TABLE_NAME.COLUMN_NAME)) Your syntax also works as long as the hint is defined in the Query Block where you want it applied and there is not an alias specified for the table. The full syntax is needed for many hints to work when using SQL Profiles by the way. Thanks again for pointing out this out as it is confusing and needed to be spelled out a little more clearly.

Kerry</description>
		<content:encoded><![CDATA[<p>Hi Tony,</p>
<p>  Thanks for the comment. Hint syntax is a bit confusing (and not really documented anywhere that I&#8217;m aware of &#8211; at least with a formal syntax diagram of list of arguments). Jonathan and I were using the less formal hint syntax which leaves out the 1st and 2nd arguments (Query_Block and Alias). This is commonly done when adding hints directly to SQL statements. So the common version of the new INDEX hint syntax would look like this:</p>
<p>/*+ INDEX(TABLE_NAME.COLUMN_NAME TABLE_NAME.COLUMN_NAME) */</p>
<p>If in fact you use this format it works fine but it will be applied within the scope of the current QB. Here&#8217;s an example:</p>
<pre>

SYS@dbm1> select /*+ index(skew.col1 skew.col2) */ count(col1) from kso.skew t  where col1 = 1 and col2 = 'asddsadasd';

 COUNT(COL1)
------------
     3199977

1 row selected.

Elapsed: 00:00:07.08
SYS@dbm1> @x

PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  3v5nxcb4nnwga, child number 0
-------------------------------------
select /*+ index(skew.col1 skew.col2) */ count(col1) from kso.skew t
where col1 = 1 and col2 = 'asddsadasd'

Plan hash value: 4272108972

-----------------------------------------------------
| Id  | Operation         | Name           | E-Rows |
-----------------------------------------------------
|   0 | SELECT STATEMENT  |                |        |
|   1 |  SORT AGGREGATE   |                |      1 |
|*  2 |   INDEX RANGE SCAN| SKEW_COL1_COL2 |      1 |
-----------------------------------------------------

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

   2 - access("COL1"=1 AND "COL2"='asddsadasd')

Note
-----
   - Warning: basic plan statistics not available. These are only collected when:
       * hint 'gather_plan_statistics' is used for the statement or
       * parameter 'statistics_level' is set to 'ALL', at session or system level

26 rows selected.

Elapsed: 00:00:00.02
SYS@dbm1> @sql_hints
Enter value for sql_id: 3v5nxcb4nnwga
Enter value for child_no: 0

OUTLINE_HINTS
-----------------------------------------------------------------------------------------------------------------------------------------------------------
IGNORE_OPTIM_EMBEDDED_HINTS
OPTIMIZER_FEATURES_ENABLE('11.2.0.2')
DB_VERSION('11.2.0.2')
OPT_PARAM('_optimizer_use_feedback' 'false')
ALL_ROWS
OUTLINE_LEAF(@"SEL$1")
INDEX(@"SEL$1" "T"@"SEL$1" ("SKEW"."COL1" "SKEW"."COL2"))

7 rows selected.

Elapsed: 00:00:01.05
</pre>
<p>So as you can see, the fully specified hint ends up looking like INDEX(QB_NAME ALIAS (TABLE_NAME.COLUMN_NAME TABLE_NAME.COLUMN_NAME)) Your syntax also works as long as the hint is defined in the Query Block where you want it applied and there is not an alias specified for the table. The full syntax is needed for many hints to work when using SQL Profiles by the way. Thanks again for pointing out this out as it is confusing and needed to be spelled out a little more clearly.</p>
<p>Kerry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FORCE_MATCH for Stored Outlines and/or SQL Baselines????? &#8211; follow up &#171; Tony&#8217;s Oracle Tips</title>
		<link>http://kerryosborne.oracle-guy.com/2009/11/fixing-bad-index-hints-in-sql-profiles-automatically/#comment-79258</link>
		<dc:creator>FORCE_MATCH for Stored Outlines and/or SQL Baselines????? &#8211; follow up &#171; Tony&#8217;s Oracle Tips</dc:creator>
		<pubDate>Mon, 26 Dec 2011 13:45:50 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1989#comment-79258</guid>
		<description>[...] seems that we are not the first to experiment with this technique. See for example  this blog by Kerry Osborne published a while ago but I think these posts have slightly different [...]</description>
		<content:encoded><![CDATA[<p>[...] seems that we are not the first to experiment with this technique. See for example  this blog by Kerry Osborne published a while ago but I think these posts have slightly different [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony Hasler</title>
		<link>http://kerryosborne.oracle-guy.com/2009/11/fixing-bad-index-hints-in-sql-profiles-automatically/#comment-79250</link>
		<dc:creator>Tony Hasler</dc:creator>
		<pubDate>Mon, 26 Dec 2011 12:08:48 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1989#comment-79250</guid>
		<description>Kerry,

I know this is an old blog but it is still of interest.  There is a typo in your description of the new index format that Jonathan has repeated in his reply.  Please feel free to correct it (I suggest both places..I doubt JL will object) and delete this comment.

The new format is not:

INDEX(TABLE_NAME.COLUMN_NAME TABLE.NAME.COLUMN_NAME …)

but

INDEX(TABLE_NAME (TABLE_NAME.COLUMN_NAME TABLE.NAME.COLUMN_NAME …))

Note the TABLE_NAME at the start and the extra brackets around the columns specifications.</description>
		<content:encoded><![CDATA[<p>Kerry,</p>
<p>I know this is an old blog but it is still of interest.  There is a typo in your description of the new index format that Jonathan has repeated in his reply.  Please feel free to correct it (I suggest both places..I doubt JL will object) and delete this comment.</p>
<p>The new format is not:</p>
<p>INDEX(TABLE_NAME.COLUMN_NAME TABLE.NAME.COLUMN_NAME …)</p>
<p>but</p>
<p>INDEX(TABLE_NAME (TABLE_NAME.COLUMN_NAME TABLE.NAME.COLUMN_NAME …))</p>
<p>Note the TABLE_NAME at the start and the extra brackets around the columns specifications.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: force_match &#171; Oracle Scratchpad</title>
		<link>http://kerryosborne.oracle-guy.com/2009/11/fixing-bad-index-hints-in-sql-profiles-automatically/#comment-6422</link>
		<dc:creator>force_match &#171; Oracle Scratchpad</dc:creator>
		<pubDate>Tue, 12 Jan 2010 19:21:24 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1989#comment-6422</guid>
		<description>[...] Jonathan Lewis @ 7:19 pm UTC Jan 12,2010   If you have looked at SQL Profiles (see for example Kerry Osborne&#8217;s blog) then you may have come across the force_match option for enabling or importing a SQL profile. I [...]</description>
		<content:encoded><![CDATA[<p>[...] Jonathan Lewis @ 7:19 pm UTC Jan 12,2010   If you have looked at SQL Profiles (see for example Kerry Osborne&#8217;s blog) then you may have come across the force_match option for enabling or importing a SQL profile. I [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Fontana</title>
		<link>http://kerryosborne.oracle-guy.com/2009/11/fixing-bad-index-hints-in-sql-profiles-automatically/#comment-5732</link>
		<dc:creator>Michael Fontana</dc:creator>
		<pubDate>Mon, 23 Nov 2009 21:15:58 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1989#comment-5732</guid>
		<description>I like the suggestion of having Oracle issue a warning when a hint is syntactically incorrect and will be ignored.  A more powerful (and probably quite difficult) behavioral change would be to have Oracle indicate when it uses a different path than what was specified (or implied????) by the hint.  This has always been such a vague and esoteric area.  I wonder where an enhancement request with Oracle support would end up?</description>
		<content:encoded><![CDATA[<p>I like the suggestion of having Oracle issue a warning when a hint is syntactically incorrect and will be ignored.  A more powerful (and probably quite difficult) behavioral change would be to have Oracle indicate when it uses a different path than what was specified (or implied????) by the hint.  This has always been such a vague and esoteric area.  I wonder where an enhancement request with Oracle support would end up?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Blogroll Report 13/11/2009-20/11/2009 &#171; Coskan&#8217;s Approach to Oracle</title>
		<link>http://kerryosborne.oracle-guy.com/2009/11/fixing-bad-index-hints-in-sql-profiles-automatically/#comment-5722</link>
		<dc:creator>Blogroll Report 13/11/2009-20/11/2009 &#171; Coskan&#8217;s Approach to Oracle</dc:creator>
		<pubDate>Sun, 22 Nov 2009 21:42:33 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1989#comment-5722</guid>
		<description>[...] 14-How to change index hints with new index hint format automatically in sql profiles? Kerry Osborne-Fixing Bad Index Hints in SQL Profiles (automatically) [...]</description>
		<content:encoded><![CDATA[<p>[...] 14-How to change index hints with new index hint format automatically in sql profiles? Kerry Osborne-Fixing Bad Index Hints in SQL Profiles (automatically) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: osborne</title>
		<link>http://kerryosborne.oracle-guy.com/2009/11/fixing-bad-index-hints-in-sql-profiles-automatically/#comment-5712</link>
		<dc:creator>osborne</dc:creator>
		<pubDate>Sun, 22 Nov 2009 01:52:11 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1989#comment-5712</guid>
		<description>Jonathan, 

Thanks for the comments. 

I totally agree that your paraphrase of what the index hint is saying is more accurate than mine. (too bad they don&#039;t document hints better, and that they don&#039;t have the option to raise a warning when they are ignored).

I also agree that the INDEX_RS(_ASC/DSC) hints are more specific and therefore a better choice when trying to force a specific plan. Unfortunately, there are some problems (i.e. bug) that cause Oracle to create an invalid hint. In the particular case I showed (2nd batch of code), the other_xml field contains the hint 

INDEX_RS_ASC(@&quot;SEL$1&quot; &quot;A&quot;@&quot;SEL$1&quot; (&quot;SKEW&quot;.&quot;COL2&quot; &quot;SKEW&quot;.&quot;COL1&quot;))

 - even though the actual plan does an 

INDEX FULL SCAN

Therefore, creating an Outline on this statement changes the plan. In this case, changing the hint to the more generic INDEX(xxx), allows the optimizer to use an INDEX FULL SCAN. By the way, 11.2 works around this bug by doing exactly that, changing the INDEX_RS_ASC to INDEX. So I am agreeing with you on this point as well, more specific is certainly better (unless of course it doesn&#039;t work, like in this corner case).

I&#039;m not much of a fan of the new index format though. I understand your point about changing indexes and in general it makes sense. With respect to Outlines/Profiles/Baselines though it seems too flexible at times. By that I mean that occasionally an Outline or Profile will not keep a plan from changing - and sometimes it&#039;s due to this non-specific Index Hint format. I think one of the reasons is that the Outline Hint created by Oracle (again pulled from the other_xml field) specifies every column contained in the index. That is to say that if a plan uses an index that contains 10 columns, all ten will be listed in the hint, regardless of the fact that only a couple of them may actually be used in the statement. You can see this in the example in the post as well. The SKEW_COL2_COL1 index has COL2 and COL1. So the hints specifies both columns, even though the SQL only references COL1. I guess it just seems more straight forward and less error prone to actually specify the index name (although I acknowledge that it may go bad at some point in the future if someone changes the indexes). 

Thanks again for your comments. 

Note: I&#039;ll have to do a little verification (and refreshing my memory) before I respond to your comments on  
&lt;a href=&quot;http://kerryosborne.oracle-guy.com/2009/07/why-isnt-oracle-using-my-outline-profile-baseline/&quot; rel=&quot;nofollow&quot;&gt;Why Isn&#039;t Oracle Using My Outline / Profile / Baseline&lt;/a&gt;.

Kerry</description>
		<content:encoded><![CDATA[<p>Jonathan, </p>
<p>Thanks for the comments. </p>
<p>I totally agree that your paraphrase of what the index hint is saying is more accurate than mine. (too bad they don&#8217;t document hints better, and that they don&#8217;t have the option to raise a warning when they are ignored).</p>
<p>I also agree that the INDEX_RS(_ASC/DSC) hints are more specific and therefore a better choice when trying to force a specific plan. Unfortunately, there are some problems (i.e. bug) that cause Oracle to create an invalid hint. In the particular case I showed (2nd batch of code), the other_xml field contains the hint </p>
<p>INDEX_RS_ASC(@&#8221;SEL$1&#8243; &#8220;A&#8221;@&#8221;SEL$1&#8243; (&#8220;SKEW&#8221;.&#8221;COL2&#8243; &#8220;SKEW&#8221;.&#8221;COL1&#8243;))</p>
<p> &#8211; even though the actual plan does an </p>
<p>INDEX FULL SCAN</p>
<p>Therefore, creating an Outline on this statement changes the plan. In this case, changing the hint to the more generic INDEX(xxx), allows the optimizer to use an INDEX FULL SCAN. By the way, 11.2 works around this bug by doing exactly that, changing the INDEX_RS_ASC to INDEX. So I am agreeing with you on this point as well, more specific is certainly better (unless of course it doesn&#8217;t work, like in this corner case).</p>
<p>I&#8217;m not much of a fan of the new index format though. I understand your point about changing indexes and in general it makes sense. With respect to Outlines/Profiles/Baselines though it seems too flexible at times. By that I mean that occasionally an Outline or Profile will not keep a plan from changing &#8211; and sometimes it&#8217;s due to this non-specific Index Hint format. I think one of the reasons is that the Outline Hint created by Oracle (again pulled from the other_xml field) specifies every column contained in the index. That is to say that if a plan uses an index that contains 10 columns, all ten will be listed in the hint, regardless of the fact that only a couple of them may actually be used in the statement. You can see this in the example in the post as well. The SKEW_COL2_COL1 index has COL2 and COL1. So the hints specifies both columns, even though the SQL only references COL1. I guess it just seems more straight forward and less error prone to actually specify the index name (although I acknowledge that it may go bad at some point in the future if someone changes the indexes). </p>
<p>Thanks again for your comments. </p>
<p>Note: I&#8217;ll have to do a little verification (and refreshing my memory) before I respond to your comments on<br />
<a href="http://kerryosborne.oracle-guy.com/2009/07/why-isnt-oracle-using-my-outline-profile-baseline/" rel="nofollow">Why Isn&#8217;t Oracle Using My Outline / Profile / Baseline</a>.</p>
<p>Kerry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://kerryosborne.oracle-guy.com/2009/11/fixing-bad-index-hints-in-sql-profiles-automatically/#comment-5711</link>
		<dc:creator>Jonathan Lewis</dc:creator>
		<pubDate>Sat, 21 Nov 2009 23:31:23 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1989#comment-5711</guid>
		<description>Kerry:

Regarding this comment:
&lt;i&gt;
INDEX(TABLE_NAME (TABLE_NAME.COLUMN_NAME TABLE.NAME.COLUMN_NAME …))
Translation: If possible, use any available index on any of these columns.
&lt;/i&gt;

I think the translation should be more like: 

&lt;i&gt;&quot;Use the index on this set of columns in this order but if the required index doesn&#039;t exist then use the cheapest index that starts with this set of columns in this order.&quot;&lt;/i&gt;

Personally I think it&#039;s a better way of hinting an index than the old &quot;index(alias index_name)&quot; method given that (a) people sometimes rename indexes to conform to naming conventions and (b) people sometimes drop one index because it starts the same way as another.  In both cases, the new mechanism is likely to reduce the risk of damage.

The &quot;index_rs(_asc/_desc)&quot; hints were introduced, by the way, because an index() hint could allow the optimizer to choose between a range scan and a full scan - and that meant that a hinted query could still change its execution path dramatically unless all the other hints had been carefully set up to avoid the error - so I wouldn&#039;t be too keen to change a index range scan hint to a simple index hint.

Regards
Jonathan Lewis</description>
		<content:encoded><![CDATA[<p>Kerry:</p>
<p>Regarding this comment:<br />
<i><br />
INDEX(TABLE_NAME (TABLE_NAME.COLUMN_NAME TABLE.NAME.COLUMN_NAME …))<br />
Translation: If possible, use any available index on any of these columns.<br />
</i></p>
<p>I think the translation should be more like: </p>
<p><i>&#8220;Use the index on this set of columns in this order but if the required index doesn&#8217;t exist then use the cheapest index that starts with this set of columns in this order.&#8221;</i></p>
<p>Personally I think it&#8217;s a better way of hinting an index than the old &#8220;index(alias index_name)&#8221; method given that (a) people sometimes rename indexes to conform to naming conventions and (b) people sometimes drop one index because it starts the same way as another.  In both cases, the new mechanism is likely to reduce the risk of damage.</p>
<p>The &#8220;index_rs(_asc/_desc)&#8221; hints were introduced, by the way, because an index() hint could allow the optimizer to choose between a range scan and a full scan &#8211; and that meant that a hinted query could still change its execution path dramatically unless all the other hints had been carefully set up to avoid the error &#8211; so I wouldn&#8217;t be too keen to change a index range scan hint to a simple index hint.</p>
<p>Regards<br />
Jonathan Lewis</p>
]]></content:encoded>
	</item>
</channel>
</rss>

