| Welcome to WebmasterWorld Guest from 188.8.131.52 |
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
|Pubcon Platinum Sponsor 2014|
|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:
| 6:22 pm on Feb 14, 2014 (gmt 0)|
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.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved