homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

Alternative to MySQL IN

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

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)

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)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved