spectrumcare
asked on
MYSQL query not using multiple column index
I have a multiple column index on a mysql table. Let's say the index is (first, second, third). When I run this query
SELECT first, second, third
FROM table
EXPLAIN shows me it is using the index. But if I run the following query
SELECT first, second, third, fourth
FROM table
it is not using the index.
Do I need all the columns that I am selecting to be in the index?
SELECT first, second, third
FROM table
EXPLAIN shows me it is using the index. But if I run the following query
SELECT first, second, third, fourth
FROM table
it is not using the index.
Do I need all the columns that I am selecting to be in the index?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Could the issue be that I have an autonumber column that is forced to have a primary index on it?
ASKER
I've got it working now. I'll give you the points for answering.
ASKER