MySQL Forums
Forum List  »  General

Index for Select on multiple rows
Posted by: Pascal Fässler
Date: July 30, 2010 09:03AM

Hi,

I thougt it's very simple, but i can't find a solution :-)

A simple table:
key1 int
key2 int
value text

I made index on key1, key2 and a combined index (key1,key2)

If I need something like
SELECT * from table WHERE key1 = ? OR key2 = ?;

mySQL will not use any index. While this table has about 1 million entries, this is a performance problem :-) Ok, if I make 2 separate SELECT's like "SELECT * from table WHERE key1 = ?" and the same for key2 and merge in in the application it will do the job.

Any ideas for a better solution?

Thanks a lot.

Options: ReplyQuote


Subject
Written By
Posted
Index for Select on multiple rows
July 30, 2010 09:03AM


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.