<?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>Percona&#039;s MySQL &#38; InnoDB performance and scalability blog</description>
	<lastBuildDate>Sat, 11 Feb 2012 16:45:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Cpt. Contrarian</title>
		<link>http://www.mysqlperformanceblog.com/2008/10/31/how-expensive-is-a-where-clause-in-mysql/comment-page-1/#comment-770673</link>
		<dc:creator>Cpt. Contrarian</dc:creator>
		<pubDate>Wed, 04 Aug 2010 19:27:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=517#comment-770673</guid>
		<description>@gizg
&gt;HOWEVER, try and write a query in a real world web app that can do without a WHERE clause!?!?!?!?!

I&#039;ve got one. I found this page because I was looking for an explanation for how my JOIN operation could get faster when I took out the WHERE clause even though that greatly multiplied the JOIN size.

Because the other side of the JOIN already limited the records as needed, the WHERE clause on the first subquery was unneeded. I assumed that having a smaller resultset would increase performance because less memory was copied and used; however, instead, having the WHERE clause on that one table tripled the overall runtime of the query. Upon reflection, I presume that&#039;s because the first subquery requires the database engine to set up a temporary table to store the resultset, while a SELECT without a WHERE means that it can read directly from the source database (likely cached) when it creates the JOINed resultset.

So, this is interesting research; and I am keen enough to find out more that I&#039;m going to do tests of my own.</description>
		<content:encoded><![CDATA[<p>@gizg<br />
&gt;HOWEVER, try and write a query in a real world web app that can do without a WHERE clause!?!?!?!?!</p>
<p>I&#8217;ve got one. I found this page because I was looking for an explanation for how my JOIN operation could get faster when I took out the WHERE clause even though that greatly multiplied the JOIN size.</p>
<p>Because the other side of the JOIN already limited the records as needed, the WHERE clause on the first subquery was unneeded. I assumed that having a smaller resultset would increase performance because less memory was copied and used; however, instead, having the WHERE clause on that one table tripled the overall runtime of the query. Upon reflection, I presume that&#8217;s because the first subquery requires the database engine to set up a temporary table to store the resultset, while a SELECT without a WHERE means that it can read directly from the source database (likely cached) when it creates the JOINed resultset.</p>
<p>So, this is interesting research; and I am keen enough to find out more that I&#8217;m going to do tests of my own.</p>
]]></content:encoded>
	</item>
	<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>
</channel>
</rss>

