<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: MySQL not being able to utilize a compound index?</title>
	<atom:link href="http://code.openark.org/blog/mysql/mysql-not-being-able-to-utilize-a-compound-index/feed" rel="self" type="application/rss+xml" />
	<link>http://code.openark.org/blog/mysql/mysql-not-being-able-to-utilize-a-compound-index</link>
	<description>Blog by Shlomi Noach</description>
	<lastBuildDate>Tue, 07 Sep 2010 05:54:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Log Buffer #146: a Carnival of the Vanities for DBAs &#124; Pythian Group Blog</title>
		<link>http://code.openark.org/blog/mysql/mysql-not-being-able-to-utilize-a-compound-index/comment-page-1#comment-1938</link>
		<dc:creator>Log Buffer #146: a Carnival of the Vanities for DBAs &#124; Pythian Group Blog</dc:creator>
		<pubDate>Fri, 15 May 2009 17:01:31 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=810#comment-1938</guid>
		<description>[...] code.openark.org, Shlomi Noach writes It seems like MySQL is unable to utilize a compound index when evaluating a plan for a query with a range condition. I’m looking for an explanation. I’ll [...]</description>
		<content:encoded><![CDATA[<p>[...] code.openark.org, Shlomi Noach writes It seems like MySQL is unable to utilize a compound index when evaluating a plan for a query with a range condition. I’m looking for an explanation. I’ll [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://code.openark.org/blog/mysql/mysql-not-being-able-to-utilize-a-compound-index/comment-page-1#comment-1861</link>
		<dc:creator>Xaprb</dc:creator>
		<pubDate>Sat, 09 May 2009 20:51:51 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=810#comment-1861</guid>
		<description>Shlomi, as others said -- this is just an optimizer weakness at the moment.  Peter posted on this a while ago, too: http://www.mysqlperformanceblog.com/2008/04/04/multi-column-in-clause-unexpected-mysql-issue/</description>
		<content:encoded><![CDATA[<p>Shlomi, as others said &#8212; this is just an optimizer weakness at the moment.  Peter posted on this a while ago, too: <a href="http://www.mysqlperformanceblog.com/2008/04/04/multi-column-in-clause-unexpected-mysql-issue/" rel="nofollow">http://www.mysqlperformanceblog.com/2008/04/04/multi-column-in-clause-unexpected-mysql-issue/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shlomi</title>
		<link>http://code.openark.org/blog/mysql/mysql-not-being-able-to-utilize-a-compound-index/comment-page-1#comment-1855</link>
		<dc:creator>shlomi</dc:creator>
		<pubDate>Sat, 09 May 2009 10:40:03 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=810#comment-1855</guid>
		<description>@Harrison,

I agree. Thanks for the reference!</description>
		<content:encoded><![CDATA[<p>@Harrison,</p>
<p>I agree. Thanks for the reference!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shlomi</title>
		<link>http://code.openark.org/blog/mysql/mysql-not-being-able-to-utilize-a-compound-index/comment-page-1#comment-1848</link>
		<dc:creator>shlomi</dc:creator>
		<pubDate>Fri, 08 May 2009 19:00:44 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=810#comment-1848</guid>
		<description>@Shantanu,

Thanks,
1. Haven&#039;t tried this with 5.1
2. I do
3. Unlimited (killed query after realizing it was running for a few minutes)</description>
		<content:encoded><![CDATA[<p>@Shantanu,</p>
<p>Thanks,<br />
1. Haven&#8217;t tried this with 5.1<br />
2. I do<br />
3. Unlimited (killed query after realizing it was running for a few minutes)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harrison Fisk</title>
		<link>http://code.openark.org/blog/mysql/mysql-not-being-able-to-utilize-a-compound-index/comment-page-1#comment-1846</link>
		<dc:creator>Harrison Fisk</dc:creator>
		<pubDate>Fri, 08 May 2009 14:22:39 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=810#comment-1846</guid>
		<description>The query isn&#039;t a subquery, however for some reason that is where the docs mentions the restriction about row operators.  I suspect it was because the row operators were added at the same time as subqueries.

Really, the restriction should be put somewhere else in the documentation, such as the index section or even where row operators are mentioned in the docs.</description>
		<content:encoded><![CDATA[<p>The query isn&#8217;t a subquery, however for some reason that is where the docs mentions the restriction about row operators.  I suspect it was because the row operators were added at the same time as subqueries.</p>
<p>Really, the restriction should be put somewhere else in the documentation, such as the index section or even where row operators are mentioned in the docs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shantanu Oak</title>
		<link>http://code.openark.org/blog/mysql/mysql-not-being-able-to-utilize-a-compound-index/comment-page-1#comment-1842</link>
		<dc:creator>Shantanu Oak</dc:creator>
		<pubDate>Fri, 08 May 2009 09:37:25 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=810#comment-1842</guid>
		<description>1) Have you tried it on 5.1 version of MySQL? 
2) Do you get the same explain plan with and without &quot;limit&quot; ?
3) What is the actual time that it took to return the results?</description>
		<content:encoded><![CDATA[<p>1) Have you tried it on 5.1 version of MySQL?<br />
2) Do you get the same explain plan with and without &#8220;limit&#8221; ?<br />
3) What is the actual time that it took to return the results?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shlomi</title>
		<link>http://code.openark.org/blog/mysql/mysql-not-being-able-to-utilize-a-compound-index/comment-page-1#comment-1838</link>
		<dc:creator>shlomi</dc:creator>
		<pubDate>Fri, 08 May 2009 03:23:42 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=810#comment-1838</guid>
		<description>@Harrison, @Dean

I don&#039;t think this query can be categorized as &quot;subquery&quot; in any way, or else the optimizer is very wrong.
Do you find that there&#039;s a &quot;sub&quot; here?</description>
		<content:encoded><![CDATA[<p>@Harrison, @Dean</p>
<p>I don&#8217;t think this query can be categorized as &#8220;subquery&#8221; in any way, or else the optimizer is very wrong.<br />
Do you find that there&#8217;s a &#8220;sub&#8221; here?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shlomi</title>
		<link>http://code.openark.org/blog/mysql/mysql-not-being-able-to-utilize-a-compound-index/comment-page-1#comment-1837</link>
		<dc:creator>shlomi</dc:creator>
		<pubDate>Fri, 08 May 2009 03:17:35 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=810#comment-1837</guid>
		<description>@Matthew,

This doesn&#039;t really change much - you just get a full index scan instead of a full table scan. If I need to get an entire row, I get no advantage. Thanks!</description>
		<content:encoded><![CDATA[<p>@Matthew,</p>
<p>This doesn&#8217;t really change much &#8211; you just get a full index scan instead of a full table scan. If I need to get an entire row, I get no advantage. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roland Bouman</title>
		<link>http://code.openark.org/blog/mysql/mysql-not-being-able-to-utilize-a-compound-index/comment-page-1#comment-1835</link>
		<dc:creator>Roland Bouman</dc:creator>
		<pubDate>Fri, 08 May 2009 00:54:05 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=810#comment-1835</guid>
		<description>darn...something is not well with literal &lt;

me tries again....

(a,b) &lt; (x,y) is equivalent to:

&lt;code&gt;CASE 
  WHEN a &gt; x THEN FALSE 
  WHEN a &lt; x THEN TRUE
  ELSE CASE
    WHEN b &lt; y THEN TRUE
    ELSE FALSE
  END
END&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>darn&#8230;something is not well with literal &lt;</p>
<p>me tries again&#8230;.</p>
<p>(a,b) &lt; (x,y) is equivalent to:</p>
<p><code>CASE<br />
  WHEN a &gt; x THEN FALSE<br />
  WHEN a &lt; x THEN TRUE<br />
  ELSE CASE<br />
    WHEN b &lt; y THEN TRUE<br />
    ELSE FALSE<br />
  END<br />
END</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roland Bouman</title>
		<link>http://code.openark.org/blog/mysql/mysql-not-being-able-to-utilize-a-compound-index/comment-page-1#comment-1834</link>
		<dc:creator>Roland Bouman</dc:creator>
		<pubDate>Fri, 08 May 2009 00:50:23 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=810#comment-1834</guid>
		<description>Hi Justin,

the syntax (a,b) &lt; (x,y)

means: 

CASE  
  WHEN a &gt; x THEN FALSE
  WHEN a = x THEN
      CASE 
         WHEN b &lt; y THEN TRUE
         ELSE FALSE
      END
END</description>
		<content:encoded><![CDATA[<p>Hi Justin,</p>
<p>the syntax (a,b) &lt; (x,y)</p>
<p>means: </p>
<p>CASE<br />
  WHEN a > x THEN FALSE<br />
  WHEN a = x THEN<br />
      CASE<br />
         WHEN b &lt; y THEN TRUE<br />
         ELSE FALSE<br />
      END<br />
END</p>
]]></content:encoded>
	</item>
</channel>
</rss>
