[thelist] How to best index this table?
rudy
r937 at interlog.com
Wed Mar 12 19:48:00 CST 2003
> How can I best index this table to optimize results?
your choices are
1. no index
2. city
3. state
4. separate indexes on city and state
5. one index on city, state
6. one index on state, city
you've run it with option 1, so you have a baseline
if the optimizer is smart, only 4, 5, and 6 will give better results
5 and 6 are called "covering" indexes, because they contain all the columns
that are needed in the query
4 also covers, but the optimizer has more work to do, grouping pairs of
values
my money's on 6, because state is char and city is varchar
do let us know your other timings
;o)
More information about the thelist
mailing list