<?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: Getting MySQL to use full key length</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2007/01/31/getting-mysql-to-use-full-key-length/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2007/01/31/getting-mysql-to-use-full-key-length/</link>
	<description>Everything about MySQL Performance</description>
	<lastBuildDate>Sat, 21 Nov 2009 05:23:57 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: chad</title>
		<link>http://www.mysqlperformanceblog.com/2007/01/31/getting-mysql-to-use-full-key-length/comment-page-1/#comment-52287</link>
		<dc:creator>chad</dc:creator>
		<pubDate>Thu, 15 Feb 2007 20:13:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/01/31/getting-mysql-to-use-full-key-length/#comment-52287</guid>
		<description>This seems to still be a weakness of MySQL.  I am running 5.0.32 enterprise and I have the same experience.  I am working with MySQL support who really have not been much help up to this point.  The workaround mentioned by Peter above does indeed work for me too, and cuts my query time from about 120 seconds to 4 seconds.  Hopefully MySQL will address this soon.

mysql&gt; select version();
+---------------------------+
&#124; version()                 &#124;
+---------------------------+
&#124; 5.0.32-enterprise-gpl-log &#124;
+---------------------------+
1 row in set (0.06 sec)

mysql&gt; explain SELECT SUM(IF(FACILITY=&#039;failedsell&#039;,1,0)), SUM(IF(FACILITY=&#039;faile
dbuy&#039;,1,0)) FROM XCORE.LOGS WHERE PARTITIONID=1 AND TIME&gt;=1171515600 AND TIME explain SELECT SUM(IF(FACILITY=&#039;failedsell&#039;,1,0)), SUM(IF(FACILITY=&#039;faile
dbuy&#039;,1,0)) FROM XCORE.LOGS AS LOGS FORCE INDEX(PARTITIONIDTIME) WHERE PARTITION
ID=1 AND TIME&gt;=1171515600 AND TIME</description>
		<content:encoded><![CDATA[<p>This seems to still be a weakness of MySQL.  I am running 5.0.32 enterprise and I have the same experience.  I am working with MySQL support who really have not been much help up to this point.  The workaround mentioned by Peter above does indeed work for me too, and cuts my query time from about 120 seconds to 4 seconds.  Hopefully MySQL will address this soon.</p>
<p>mysql&gt; select version();<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| version()                 |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| 5.0.32-enterprise-gpl-log |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
1 row in set (0.06 sec)</p>
<p>mysql&gt; explain SELECT SUM(IF(FACILITY=&#8217;failedsell&#8217;,1,0)), SUM(IF(FACILITY=&#8217;faile<br />
dbuy&#8217;,1,0)) FROM XCORE.LOGS WHERE PARTITIONID=1 AND TIME&gt;=1171515600 AND TIME explain SELECT SUM(IF(FACILITY=&#8217;failedsell&#8217;,1,0)), SUM(IF(FACILITY=&#8217;faile<br />
dbuy&#8217;,1,0)) FROM XCORE.LOGS AS LOGS FORCE INDEX(PARTITIONIDTIME) WHERE PARTITION<br />
ID=1 AND TIME&gt;=1171515600 AND TIME</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: araki</title>
		<link>http://www.mysqlperformanceblog.com/2007/01/31/getting-mysql-to-use-full-key-length/comment-page-1/#comment-43186</link>
		<dc:creator>araki</dc:creator>
		<pubDate>Sun, 04 Feb 2007 10:19:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/01/31/getting-mysql-to-use-full-key-length/#comment-43186</guid>
		<description>typo: &quot;worse it can can select something&quot;</description>
		<content:encoded><![CDATA[<p>typo: &#8220;worse it can can select something&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2007/01/31/getting-mysql-to-use-full-key-length/comment-page-1/#comment-40954</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Thu, 01 Feb 2007 09:16:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/01/31/getting-mysql-to-use-full-key-length/#comment-40954</guid>
		<description>Sergey,

This case is from MySQL 4.1.22  so it might be fixed in later versions. 
In later versions it might be fixed but in older you need to use workaround as described. 

Regarding choosing wrong key like (A,D) instead of (A,B)  I&#039;m confident the bug happens in MySQL 5.0  I&#039;ll get you the test case as soon as we see it again.</description>
		<content:encoded><![CDATA[<p>Sergey,</p>
<p>This case is from MySQL 4.1.22  so it might be fixed in later versions.<br />
In later versions it might be fixed but in older you need to use workaround as described. </p>
<p>Regarding choosing wrong key like (A,D) instead of (A,B)  I&#8217;m confident the bug happens in MySQL 5.0  I&#8217;ll get you the test case as soon as we see it again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergey Petrunia</title>
		<link>http://www.mysqlperformanceblog.com/2007/01/31/getting-mysql-to-use-full-key-length/comment-page-1/#comment-40769</link>
		<dc:creator>Sergey Petrunia</dc:creator>
		<pubDate>Wed, 31 Jan 2007 23:52:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/01/31/getting-mysql-to-use-full-key-length/#comment-40769</guid>
		<description>Peter, this ought to work. The EXPLAIN should be like in the second case whether FORCE INDEX clause is present or not.
The &quot;use range(index) instead of ref(the-same-index)&quot; heuristics has been in the code since long time. IIRC it had some bug but we&#039;ve fixed quite some time ago.
Could you please post the table DDL and data sample, or file a bug? I&#039;m interested to look.</description>
		<content:encoded><![CDATA[<p>Peter, this ought to work. The EXPLAIN should be like in the second case whether FORCE INDEX clause is present or not.<br />
The &#8220;use range(index) instead of ref(the-same-index)&#8221; heuristics has been in the code since long time. IIRC it had some bug but we&#8217;ve fixed quite some time ago.<br />
Could you please post the table DDL and data sample, or file a bug? I&#8217;m interested to look.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
