Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Key Compression vs. Selectivity
<hasta_l3_at_hotmail.com> wrote in message
news:1166423707.587373.30730_at_80g2000cwy.googlegroups.com...
Jonathan Lewis a écrit :
> "Robert Klemme" <shortcutter_at_googlemail.com> wrote in message
> >
> > The general rule of thumb for indexing is to put the most selective
> > columns first in order to foster fast lookups. (Of course there are
> > other considerations involved, which single index covers most queries
> > etc.)
>
> The "most selective first" has always been a little
> flexible (at least since 6.0 appeared)
Jonathan and Robert....
Why would the rule of thumb "put the most selective column first" be a good one to any degree ?
(let's assume that permutations of index columns don't impact the number of queries covered)
In passing - there is at least one (slightly convoluted) special case where "most selective first" is a good idea, as it allows the optimizer to generate a plan that CAN use the index, and any other alternative makes things inefficient. I'll probably blog about it some time, but it's not generally very useful to make a fuss about it.
-- Regards Jonathan Lewis http://jonathanlewis.wordpress.com Author: Cost Based Oracle: Fundamentals http://www.jlcomp.demon.co.uk/cbo_book/ind_book.html The Co-operative Oracle Users' FAQ http://www.jlcomp.demon.co.uk/faq/ind_faq.htmlReceived on Mon Dec 18 2006 - 13:22:55 CST