<?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: How expensive is a WHERE clause in MySQL?</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2008/10/31/how-expensive-is-a-where-clause-in-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2008/10/31/how-expensive-is-a-where-clause-in-mysql/</link>
	<description>Everything about MySQL Performance</description>
	<lastBuildDate>Sat, 07 Nov 2009 18:35:44 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: gizg</title>
		<link>http://www.mysqlperformanceblog.com/2008/10/31/how-expensive-is-a-where-clause-in-mysql/comment-page-1/#comment-399834</link>
		<dc:creator>gizg</dc:creator>
		<pubDate>Tue, 02 Dec 2008 20:55:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=517#comment-399834</guid>
		<description>All well and good being a student with plenty of time on your hands to do such trivial (read: useless) tests!
HOWEVER, try and write a query in a real world web app that can do without a WHERE clause!?!?!?!?!</description>
		<content:encoded><![CDATA[<p>All well and good being a student with plenty of time on your hands to do such trivial (read: useless) tests!<br />
HOWEVER, try and write a query in a real world web app that can do without a WHERE clause!?!?!?!?!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Baron Schwartz</title>
		<link>http://www.mysqlperformanceblog.com/2008/10/31/how-expensive-is-a-where-clause-in-mysql/comment-page-1/#comment-372428</link>
		<dc:creator>Baron Schwartz</dc:creator>
		<pubDate>Tue, 04 Nov 2008 13:29:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=517#comment-372428</guid>
		<description>Pep, yes, the index is half the physical size.  The row estimate is only an estimate.  The stats are inexact.</description>
		<content:encoded><![CDATA[<p>Pep, yes, the index is half the physical size.  The row estimate is only an estimate.  The stats are inexact.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pep Pla</title>
		<link>http://www.mysqlperformanceblog.com/2008/10/31/how-expensive-is-a-where-clause-in-mysql/comment-page-1/#comment-372350</link>
		<dc:creator>Pep Pla</dc:creator>
		<pubDate>Tue, 04 Nov 2008 10:18:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=517#comment-372350</guid>
		<description>Show table status gives half the size of the table to the index.

Also explain gives half (???) the rows if using the index.

I can understand that the index takes less space than the table as all the keys are the same but why the optimizer believes that using the index requieres half the rows? because is a b-tree?

Pep</description>
		<content:encoded><![CDATA[<p>Show table status gives half the size of the table to the index.</p>
<p>Also explain gives half (???) the rows if using the index.</p>
<p>I can understand that the index takes less space than the table as all the keys are the same but why the optimizer believes that using the index requieres half the rows? because is a b-tree?</p>
<p>Pep</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pep Pla</title>
		<link>http://www.mysqlperformanceblog.com/2008/10/31/how-expensive-is-a-where-clause-in-mysql/comment-page-1/#comment-372340</link>
		<dc:creator>Pep Pla</dc:creator>
		<pubDate>Tue, 04 Nov 2008 09:49:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=517#comment-372340</guid>
		<description>Sheri,

MySQL Optimizer does something called: Constant condition removal.
This means that a condition like this TRUE or 5=5 is going to be
removed by the optimizer prior to query execution.

Mark,
Is it possible that using a index is faster because counting index records is
faster than counting table records? It is important to realize that all the
index keys are the same so probably the table is larger than the index and
executing the query takes less io -&gt; faster. (I&#039;ll check table size vs. index size)

Pep</description>
		<content:encoded><![CDATA[<p>Sheri,</p>
<p>MySQL Optimizer does something called: Constant condition removal.<br />
This means that a condition like this TRUE or 5=5 is going to be<br />
removed by the optimizer prior to query execution.</p>
<p>Mark,<br />
Is it possible that using a index is faster because counting index records is<br />
faster than counting table records? It is important to realize that all the<br />
index keys are the same so probably the table is larger than the index and<br />
executing the query takes less io -&gt; faster. (I&#8217;ll check table size vs. index size)</p>
<p>Pep</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheeri K. Cabral</title>
		<link>http://www.mysqlperformanceblog.com/2008/10/31/how-expensive-is-a-where-clause-in-mysql/comment-page-1/#comment-370728</link>
		<dc:creator>Sheeri K. Cabral</dc:creator>
		<pubDate>Sat, 01 Nov 2008 20:45:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=517#comment-370728</guid>
		<description>How much of this is actually overhead because of the comparison versus the where?

ie, can you compare with 

WHERE TRUE
and
WHERE 1=1
and 
WHERE &#039;a&#039;=&#039;a&#039;?  That would be much more interesting, because the 60% or 87% are likely because of the access and comparison costs.  But how much is the actual WHERE costing?  

There&#039;s also explain plan overhead.</description>
		<content:encoded><![CDATA[<p>How much of this is actually overhead because of the comparison versus the where?</p>
<p>ie, can you compare with </p>
<p>WHERE TRUE<br />
and<br />
WHERE 1=1<br />
and<br />
WHERE &#8216;a&#8217;='a&#8217;?  That would be much more interesting, because the 60% or 87% are likely because of the access and comparison costs.  But how much is the actual WHERE costing?  </p>
<p>There&#8217;s also explain plan overhead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MC.Spring</title>
		<link>http://www.mysqlperformanceblog.com/2008/10/31/how-expensive-is-a-where-clause-in-mysql/comment-page-1/#comment-370029</link>
		<dc:creator>MC.Spring</dc:creator>
		<pubDate>Sat, 01 Nov 2008 01:26:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=517#comment-370029</guid>
		<description>I think you should use none function in the where case for the last statement, while that maybe took a little time down.</description>
		<content:encoded><![CDATA[<p>I think you should use none function in the where case for the last statement, while that maybe took a little time down.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://www.mysqlperformanceblog.com/2008/10/31/how-expensive-is-a-where-clause-in-mysql/comment-page-1/#comment-369583</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Fri, 31 Oct 2008 14:49:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=517#comment-369583</guid>
		<description>Well that is three things I have learned in one post - awesome!
Thx
Marty</description>
		<content:encoded><![CDATA[<p>Well that is three things I have learned in one post &#8211; awesome!<br />
Thx<br />
Marty</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Baron Schwartz</title>
		<link>http://www.mysqlperformanceblog.com/2008/10/31/how-expensive-is-a-where-clause-in-mysql/comment-page-1/#comment-369581</link>
		<dc:creator>Baron Schwartz</dc:creator>
		<pubDate>Fri, 31 Oct 2008 14:42:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=517#comment-369581</guid>
		<description>InnoDB has a hidden 6-byte primary key.</description>
		<content:encoded><![CDATA[<p>InnoDB has a hidden 6-byte primary key.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://www.mysqlperformanceblog.com/2008/10/31/how-expensive-is-a-where-clause-in-mysql/comment-page-1/#comment-369578</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Fri, 31 Oct 2008 14:21:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=517#comment-369578</guid>
		<description>I&#039;m confused. Where did the Primary Key come from in:
CREATE TABLE `t` (`a` date NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
?</description>
		<content:encoded><![CDATA[<p>I&#8217;m confused. Where did the Primary Key come from in:<br />
CREATE TABLE `t` (`a` date NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;<br />
?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Baron Schwartz</title>
		<link>http://www.mysqlperformanceblog.com/2008/10/31/how-expensive-is-a-where-clause-in-mysql/comment-page-1/#comment-369577</link>
		<dc:creator>Baron Schwartz</dc:creator>
		<pubDate>Fri, 31 Oct 2008 14:17:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=517#comment-369577</guid>
		<description>Of course -- because it&#039;s using the primary key.

My point in asking those questions was to get you thinking about the query plan.  You can&#039;t compare the primary key to the secondary key and say that the difference is due to where clauses or not having where clauses.  I think you&#039;re misunderstanding how the storage engine api and InnoDB indexes work.</description>
		<content:encoded><![CDATA[<p>Of course &#8212; because it&#8217;s using the primary key.</p>
<p>My point in asking those questions was to get you thinking about the query plan.  You can&#8217;t compare the primary key to the secondary key and say that the difference is due to where clauses or not having where clauses.  I think you&#8217;re misunderstanding how the storage engine api and InnoDB indexes work.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
