Re: oracle indexes

From: news.verizon.net <kennedyii_at_verizon.net>
Date: Thu, 05 Jun 2008 04:22:00 GMT
Message-ID: <IRJ1k.2452$v%.695@trndny04>

"doug" <douglass_davis_at_earthlink.net> wrote in message news:a95d43e0-f441-4fc8-8943-75c2e4a90e86_at_8g2000hse.googlegroups.com...
>
>
> Hello,
>
> Say If I have a table with column a, and column b (say they are
> integers).
>
> Sometimes I will do a query with a where clause that just references
> column a.
>
> Sometimes I will do a query with a where clause that references both
> column a and b.
>
> Is there a need to create an index with a, and an index with a, b? Or
> will an index with a,b work for both of the above types of queries?
>
>
>
>
> I know in mysql if I have an index (a, b, c), then it is useful for
> queries referencing a or a,b or a, b,c. But, I am not as familiar
> with how Oracle indexes work.
>
> Thanks.

It depends on the version; there are some subtle differences. (eg index skip scan) In Oracle 7 and 8 if you created an index on a,b then a search on a could use the index and a search on a and b could use the index. A search only on b could not.
Jim Received on Wed Jun 04 2008 - 23:22:00 CDT

Original text of this message