Hacker Newsnew | comments | show | ask | jobs | submit login

MySQL's query plan is odd at times. What does an explain look like on that query? If any portion of the query, including subselects isn't able to use an index, it will report it. You can try to force indicies with USE INDEX/FORCE INDEX which can sometimes help.



http://cd34.com/blog/scalability/mysql-query-optimization/ http://cd34.com/blog/scalability/mysql-5-1s-query-optimizer/

-----


Ah, I was having trouble with another slow query; however, the EXPLAIN showed that the correct indices were used. I managed to speed it up by restricting the size of the inner SELECT with some extra constraints. From 4 seconds downto 0.1 seconds!

-----


Thank you for these tips. I'll try them out later today.

-----




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: