Comments on: Why won’t MySQL use the best index in a join? http://www.xaprb.com/blog/2012/08/20/why-wont-mysql-use-the-best-index-in-a-join/ Stay curious! Thu, 02 May 2013 12:36:53 +0000 hourly 1 http://wordpress.org/?v=3.5.1 By: Xaprb http://www.xaprb.com/blog/2012/08/20/why-wont-mysql-use-the-best-index-in-a-join/#comment-20169 Xaprb Mon, 20 Aug 2012 18:17:34 +0000 http://www.xaprb.com/blog/?p=2304#comment-20169 Eplaut,

I know, this is not the ideal index, although in the real production use case it is fine and does not need to be optimized further; the cost and effort would not result in enough improvement to be worth it. The point of this post was simply to show readers how to figure out what the execution plan is doing in some cases.

]]>
By: eplaut http://www.xaprb.com/blog/2012/08/20/why-wont-mysql-use-the-best-index-in-a-join/#comment-20166 eplaut Mon, 20 Aug 2012 17:28:55 +0000 http://www.xaprb.com/blog/?p=2304#comment-20166 Hi,

one more issue can make idx_intcol more effective.
the url-int index is very big one (each node need to contain a lot of chars (which i can assume that the beginning is quite the same “http://aaa.bbb.com/blablka”.
this issue cause to a very “deep” index which require a lot of reading in the index tree.
the small int is a much smaller index, and the needs for IS NULL (or not exist in the EXPLAIN) makes the search easier since it not need to read the actual data.

i.e. if it will not find the int – the row matches.
if it does, it will go to the rows which has the same in and check the url…

Can you can post the EXPLAIN after the charset change?

]]>
By: Ole http://www.xaprb.com/blog/2012/08/20/why-wont-mysql-use-the-best-index-in-a-join/#comment-20164 Ole Mon, 20 Aug 2012 15:59:43 +0000 http://www.xaprb.com/blog/?p=2304#comment-20164 Nice article. Short, simple to understand and to the point. Thanks for this good advice

]]>