Re: Why does Oracle sometimes favor an index based on column position in the index?

  • From: Martin Berger <martin.a.berger@xxxxxxxxx>
  • To: ChrisDavid.Taylor@xxxxxxxxxxxxxxx
  • Date: Thu, 20 Jan 2011 21:29:10 +0100

Chris,

can you tell me more infos about the WHERE clause, the number of rows in the 
index, and the number of distinct values (and NULLs) of columnA and columnB? 
The CBO is not smart, it's just following a set of rules. Let's try to mimic 
these rules.
(what RDBMS-version are you using?)

I doesn't think about the order yet, maybe later ;-) 
Martin 

Am 20.01.2011 um 19:54 schrieb Taylor, Chris David:

> This is something I’ve always wondered about and I’m looking for ideas (or 
> even the answer itself) 

>  So it seems that I have 2 things going on:
> 1.)    Oracle “prefers” to use an index with too few columns versus 1 that 
> has too many?
> 2.)    Or Oracle prefers to have INDEX columns in a specific order?
>  
> (Come to think of it, there is an ORDERED hint in the SQL so maybe the order 
> the WHERE clauses were impacting which INDEX Oracle chose?  I think I was 
> under the impression the ORDERED hint only impacted the order of the joins)
>  

Other related posts: