|
Posted by Alexander Kuznetsov on 06/09/06 13:12
> > Not necessarily. Consider the following query:
> >
> > select lastname, firstname from some_table where firstname = ...
> >
> > It will use the index, and, more to the point, it will not touch the
> > table at all - the index already has all the information the query
> > needs. It is called "index covering".
>
> No, it won't. If you had a list of people on a piece of paper, sorted
> by last name and then by first name, explain how you would use that
> list to find everyone with a first name of "Joe" without looking
> through the entire list.
Why don't you try it out in practice? You might be in for some
surprise. If the index is smaller than the table, and contains all the
necessary information, it is likely to be used instead of the table.
Google up "index covering".
[Back to original message]
|