MySQL Forums
Forum List  »  Optimizer & Parser

Query Optimizer Problems
Posted by: laurenty
Date: October 15, 2004 12:35PM

Hi,

I have a simple query that looks like
SELECT t.siteid FROM table t WHERE t.userid IN (1,2,3)

when running an EXPLAIN on this query I get
possible_keys: userid, userid_3
key: studentid_2
ref: NULL

the query should be using userid_3 (userid, siteid) instead of studentid_2 (studentid, userid, siteid, year)
The studentid_2 index is twice a big as the userid_3 index.

I've ran analyze, optimize, check, and repair on the table and it made no difference.
any ideas???

Thanks,

Laurent

Options: ReplyQuote


Subject
Views
Written By
Posted
Query Optimizer Problems
3008
October 15, 2004 12:35PM
2451
October 15, 2004 02:11PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.