Re: indexing
Posted in 2004
tomcaml@yahoo.com (tomL) wrote in message news:<3158a6a2.0408301033.2b1ab17b@posting.google.com>...
> hello all!
>
> a few indexing questions:
>
> If the columns I filter on in my query are a subset of the columns in
> an index, will the index be used?
>
> Also -- does the order in which the columns are specified in my filter
> matter?
>
> thank you
> tom
given index
create index mytable_1x on mytable(a,b,c);
If you don't include at least the "a" column then it won't use the
index. The other columns are optional but because you created a
compound index you expect to know a,b,c more often or not. Another use
is to get C quickly if you know A and B.
select C from mytable where a=4 and b=5 ;
This is because the optimizer will only look at the index for the
information, since it has all of the information needed for the query.