Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Alternative to MySQL IN



10:02 am on Feb 14, 2014 (gmt 0)

10+ Year Member

I'm using the following query and it's getting logged to the slow queries log. Is there a more efficient way of retrieving the data.

select SQL_CACHE code,minprice from thetable where code in ('a','b','c','d','e','f') order by minprice


11:56 am on Feb 14, 2014 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

have you tried using EXPLAIN?

MySQL :: MySQL 5.0 Reference Manual :: 8.2.1 Optimizing Queries with EXPLAIN:
http://dev.mysql.com/doc/refman/5.0/en/using-explain.html [dev.mysql.com]


6:22 pm on Feb 14, 2014 (gmt 0)

10+ Year Member

I phranque

I have used EXPLAIN and it shows the indexes are used but it's still very slow, 4.8 seconds to return results, that's why I was wondering if there is a more efficient way than using the IN clause.

Featured Threads

Hot Threads This Week

Hot Threads This Month