<?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: Is the query cache useful?</title>
	<atom:link href="http://www.pythian.com/news/4142/is-the-query-cache-useful/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pythian.com/news/4142/is-the-query-cache-useful/</link>
	<description>News and views from Pythian DBAs</description>
	<lastBuildDate>Sat, 20 Mar 2010 20:27:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Sheeri</title>
		<link>http://www.pythian.com/news/4142/is-the-query-cache-useful/#comment-377818</link>
		<dc:creator>Sheeri</dc:creator>
		<pubDate>Fri, 02 Oct 2009 21:05:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=4142#comment-377818</guid>
		<description>Baron -- Let me clarify -- among the clients I&#039;ve worked with that have upgraded, the query cache isn&#039;t widely used.

It&#039;s true that the query cache is widely used, though how many times do you end up turning off the query cache?  For me it&#039;s about 50% of the time.....so I&#039;m talking specifically about the subset of clients I&#039;ve seen in the past 6 months or so....

Pythian checks that and many other variables on our initial audits of systems; so yes, we see it being used widely, but we ensure that we recommend using it only where appropriate, and we recommend turning it off when appropriate as well.</description>
		<content:encoded><![CDATA[<p>Baron &#8212; Let me clarify &#8212; among the clients I&#8217;ve worked with that have upgraded, the query cache isn&#8217;t widely used.</p>
<p>It&#8217;s true that the query cache is widely used, though how many times do you end up turning off the query cache?  For me it&#8217;s about 50% of the time&#8230;..so I&#8217;m talking specifically about the subset of clients I&#8217;ve seen in the past 6 months or so&#8230;.</p>
<p>Pythian checks that and many other variables on our initial audits of systems; so yes, we see it being used widely, but we ensure that we recommend using it only where appropriate, and we recommend turning it off when appropriate as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.pythian.com/news/4142/is-the-query-cache-useful/#comment-377812</link>
		<dc:creator>Xaprb</dc:creator>
		<pubDate>Fri, 02 Oct 2009 20:12:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=4142#comment-377812</guid>
		<description>Sheeri,

You said it&#039;s not widely used -- actually I&#039;d say about 90% of new clients I see ARE using it.  This week even I saw someone with a 1GB query cache (I&#039;ve seen bigger, but not often).  I think that probably the most common reason for this is that intermediate-level users turn it on when trying to get more performance from their systems.

That&#039;s all just wild guessing.</description>
		<content:encoded><![CDATA[<p>Sheeri,</p>
<p>You said it&#8217;s not widely used &#8212; actually I&#8217;d say about 90% of new clients I see ARE using it.  This week even I saw someone with a 1GB query cache (I&#8217;ve seen bigger, but not often).  I think that probably the most common reason for this is that intermediate-level users turn it on when trying to get more performance from their systems.</p>
<p>That&#8217;s all just wild guessing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hide-and-SQL &#187; Blog Archive &#187; usefulness of the query cache</title>
		<link>http://www.pythian.com/news/4142/is-the-query-cache-useful/#comment-377471</link>
		<dc:creator>Hide-and-SQL &#187; Blog Archive &#187; usefulness of the query cache</dc:creator>
		<pubDate>Wed, 30 Sep 2009 16:55:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=4142#comment-377471</guid>
		<description>[...] of talk lately about the effectiveness or lack thereof of the MySQL query cache.  I&#8217;m kind of [...]</description>
		<content:encoded><![CDATA[<p>[...] of talk lately about the effectiveness or lack thereof of the MySQL query cache.  I&#8217;m kind of [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheeri Cabral</title>
		<link>http://www.pythian.com/news/4142/is-the-query-cache-useful/#comment-377429</link>
		<dc:creator>Sheeri Cabral</dc:creator>
		<pubDate>Wed, 30 Sep 2009 13:10:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=4142#comment-377429</guid>
		<description>Mark -- good to know what causes it!</description>
		<content:encoded><![CDATA[<p>Mark &#8212; good to know what causes it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Callaghan</title>
		<link>http://www.pythian.com/news/4142/is-the-query-cache-useful/#comment-377346</link>
		<dc:creator>Mark Callaghan</dc:creator>
		<pubDate>Wed, 30 Sep 2009 00:05:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=4142#comment-377346</guid>
		<description>There were some cases in 5.0.84 where lock-waits for query cache locks would timeout allowing some sessions to ignore checking the query cache when there was mutex contention. That code is not in 5.0.44 and 5.1.38. It explains my results.</description>
		<content:encoded><![CDATA[<p>There were some cases in 5.0.84 where lock-waits for query cache locks would timeout allowing some sessions to ignore checking the query cache when there was mutex contention. That code is not in 5.0.44 and 5.1.38. It explains my results.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheeri Cabral</title>
		<link>http://www.pythian.com/news/4142/is-the-query-cache-useful/#comment-377334</link>
		<dc:creator>Sheeri Cabral</dc:creator>
		<pubDate>Tue, 29 Sep 2009 22:49:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=4142#comment-377334</guid>
		<description>Mark -- I&#039;m not aware of the behavior, but the optimizer has had some pretty wonky bugs fixed, and other bugs introduced, in that time.  The query cache isn&#039;t widely used (because it takes work and tools like memcached are better) so my lack of seeing the issue doesn&#039;t mean it doesn&#039;t exist in the wild....

My point is that the &quot;noise&quot; from the bad query cache may not have been noticed -- at least not yet.  I&#039;ve had experience going from 5.0.45 and 5.0.51 to 5.1.31 and up, and experience going to 5.0.84, but I can&#039;t recall going from 5.0.84 to 5.1.3X -- there hasn&#039;t been a driving need to upgrade 5.0.84 clients to 5.1 yet.....So maybe I haven&#039;t seen it (and in general it hasn&#039;t been seen) because very few people are migrating from 5.0.84 to 5.1.3X.

On the whole, the worst-case behavior of the query cache is unacceptable even in the &quot;better&quot; stage, and given the many different operations that happen in a &quot;worst-case system&quot; to a &quot;real life system&quot;, it may be that only the worst-case system is affected by whatever was changed.  Hard to know, really.

It also might be that the performance is only affected when you&#039;re filling the query cache, ie when it&#039;s mostly empty and you&#039;re adding queries....if that&#039;s the case, slowness wouldn&#039;t be noticed because there&#039;s slowness when mysqld restarts due to filling the innodb_buffer_pool too.

So....it&#039;s hard to say 1) if the problem you found exists in real scenarios where the query cache is used and 2) if it does, the problem might be small and transient, and not really significant.

But to answer your question, we have *not* seen a drastic reduction in queries due to upgrading and the query cache.  

(we have seen this: http://bugs.mysql.com/bug.php?id=36259 which is fixed in 5.1.37, and noticed as early as 5.0.22..., but that was after we&#039;d defragmented some tables as part of an upgrade, since we had a long downtime window....)</description>
		<content:encoded><![CDATA[<p>Mark &#8212; I&#8217;m not aware of the behavior, but the optimizer has had some pretty wonky bugs fixed, and other bugs introduced, in that time.  The query cache isn&#8217;t widely used (because it takes work and tools like memcached are better) so my lack of seeing the issue doesn&#8217;t mean it doesn&#8217;t exist in the wild&#8230;.</p>
<p>My point is that the &#8220;noise&#8221; from the bad query cache may not have been noticed &#8212; at least not yet.  I&#8217;ve had experience going from 5.0.45 and 5.0.51 to 5.1.31 and up, and experience going to 5.0.84, but I can&#8217;t recall going from 5.0.84 to 5.1.3X &#8212; there hasn&#8217;t been a driving need to upgrade 5.0.84 clients to 5.1 yet&#8230;..So maybe I haven&#8217;t seen it (and in general it hasn&#8217;t been seen) because very few people are migrating from 5.0.84 to 5.1.3X.</p>
<p>On the whole, the worst-case behavior of the query cache is unacceptable even in the &#8220;better&#8221; stage, and given the many different operations that happen in a &#8220;worst-case system&#8221; to a &#8220;real life system&#8221;, it may be that only the worst-case system is affected by whatever was changed.  Hard to know, really.</p>
<p>It also might be that the performance is only affected when you&#8217;re filling the query cache, ie when it&#8217;s mostly empty and you&#8217;re adding queries&#8230;.if that&#8217;s the case, slowness wouldn&#8217;t be noticed because there&#8217;s slowness when mysqld restarts due to filling the innodb_buffer_pool too.</p>
<p>So&#8230;.it&#8217;s hard to say 1) if the problem you found exists in real scenarios where the query cache is used and 2) if it does, the problem might be small and transient, and not really significant.</p>
<p>But to answer your question, we have *not* seen a drastic reduction in queries due to upgrading and the query cache.  </p>
<p>(we have seen this: <a href="http://bugs.mysql.com/bug.php?id=36259" rel="nofollow">http://bugs.mysql.com/bug.php?id=36259</a> which is fixed in 5.1.37, and noticed as early as 5.0.22&#8230;, but that was after we&#8217;d defragmented some tables as part of an upgrade, since we had a long downtime window&#8230;.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Callaghan</title>
		<link>http://www.pythian.com/news/4142/is-the-query-cache-useful/#comment-377304</link>
		<dc:creator>Mark Callaghan</dc:creator>
		<pubDate>Tue, 29 Sep 2009 18:50:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=4142#comment-377304</guid>
		<description>I could have been much more clear.

The point of my post was that worst-case behavior of the query cache changed significantly from 5.0.44 (bad) to 5.0.84 (better) to 5.1.3X (bad again). Whether or not the query cache is useful is a different issue. Changes in code that lead to drastic changes in performance make stable systems much harder to build.

Are you aware of this behavior change in the query cache?</description>
		<content:encoded><![CDATA[<p>I could have been much more clear.</p>
<p>The point of my post was that worst-case behavior of the query cache changed significantly from 5.0.44 (bad) to 5.0.84 (better) to 5.1.3X (bad again). Whether or not the query cache is useful is a different issue. Changes in code that lead to drastic changes in performance make stable systems much harder to build.</p>
<p>Are you aware of this behavior change in the query cache?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheeri Cabral</title>
		<link>http://www.pythian.com/news/4142/is-the-query-cache-useful/#comment-377288</link>
		<dc:creator>Sheeri Cabral</dc:creator>
		<pubDate>Tue, 29 Sep 2009 16:04:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=4142#comment-377288</guid>
		<description>Wrene -- indeed, and that&#039;s one of the things that Eric meant when he said &quot;especially when alternatives exist&quot;....

There&#039;s even a memcached storage engine.  

http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/
states that there are some good reasons to use the query cache:

&quot;Third party application –  You can’t change how it works with MySQL to add caching but you can enable query cache so it works faster.

Low load applications – If you’re building application which is not designed for extreme load, like many personal application query cache might be all you need. Especially if it is mostly read only scenario. &quot;

And I totally agree, with one addition:  If you have the time and knowledge to use the query cache appropriately but not to use other tools (such as memcached) appropriately, then it&#039;s the right solution.  Using memcached means rewriting code, which a lot of organizations are loath to do.  But definitely, it&#039;s a HUGE win, and I recommend it over the MySQL query cache for most cases.

I just don&#039;t think the query cache should be removed.  Perhaps tweaked a bit, so that it won&#039;t check the query cache for every SELECT query, more insight into what&#039;s in the query cache itself, etc.</description>
		<content:encoded><![CDATA[<p>Wrene &#8212; indeed, and that&#8217;s one of the things that Eric meant when he said &#8220;especially when alternatives exist&#8221;&#8230;.</p>
<p>There&#8217;s even a memcached storage engine.  </p>
<p><a href="http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/" rel="nofollow">http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/</a><br />
states that there are some good reasons to use the query cache:</p>
<p>&#8220;Third party application –  You can’t change how it works with MySQL to add caching but you can enable query cache so it works faster.</p>
<p>Low load applications – If you’re building application which is not designed for extreme load, like many personal application query cache might be all you need. Especially if it is mostly read only scenario. &#8221;</p>
<p>And I totally agree, with one addition:  If you have the time and knowledge to use the query cache appropriately but not to use other tools (such as memcached) appropriately, then it&#8217;s the right solution.  Using memcached means rewriting code, which a lot of organizations are loath to do.  But definitely, it&#8217;s a HUGE win, and I recommend it over the MySQL query cache for most cases.</p>
<p>I just don&#8217;t think the query cache should be removed.  Perhaps tweaked a bit, so that it won&#8217;t check the query cache for every SELECT query, more insight into what&#8217;s in the query cache itself, etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheeri Cabral</title>
		<link>http://www.pythian.com/news/4142/is-the-query-cache-useful/#comment-377286</link>
		<dc:creator>Sheeri Cabral</dc:creator>
		<pubDate>Tue, 29 Sep 2009 15:53:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=4142#comment-377286</guid>
		<description>Eric -- I don&#039;t have benchmarks, but I have used it with DEMAND and SELECT queries with the SQL_CACHE keyword in the past and seen dramatic improvements -- I don&#039;t have numbers, but I have seen it work.

I have also seen it make things worse when turned on blindly.

I think that if we removed every feature that &quot;most people&quot; might turn on without looking at it because doing that causes bad performance, we&#039;d have to turn off lots of features and remove a lot of custom SQL that is currently allowed.

The query cache is off by default, which is as it should be.  

There are warnings on the manual page, which &quot;most users&quot; will actually read.</description>
		<content:encoded><![CDATA[<p>Eric &#8212; I don&#8217;t have benchmarks, but I have used it with DEMAND and SELECT queries with the SQL_CACHE keyword in the past and seen dramatic improvements &#8212; I don&#8217;t have numbers, but I have seen it work.</p>
<p>I have also seen it make things worse when turned on blindly.</p>
<p>I think that if we removed every feature that &#8220;most people&#8221; might turn on without looking at it because doing that causes bad performance, we&#8217;d have to turn off lots of features and remove a lot of custom SQL that is currently allowed.</p>
<p>The query cache is off by default, which is as it should be.  </p>
<p>There are warnings on the manual page, which &#8220;most users&#8221; will actually read.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wrene</title>
		<link>http://www.pythian.com/news/4142/is-the-query-cache-useful/#comment-377282</link>
		<dc:creator>wrene</dc:creator>
		<pubDate>Tue, 29 Sep 2009 15:39:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=4142#comment-377282</guid>
		<description>I wonder if it would be possible to use memcached -&gt; http://www.danga.com/memcached/
with clustering -&gt; http://code.google.com/p/memcached/wiki/FAQ#Cluster_Architecture_Questions

to at some determined thingy(technical term) move the query cached queries to memcached cluster.. Of course dispose of them per thingy as needed by some mid tier thingy doing all this juggling.. I&#039;ll bet one could get very nice performance..

just a thought..theory.. speculation</description>
		<content:encoded><![CDATA[<p>I wonder if it would be possible to use memcached -&gt; <a href="http://www.danga.com/memcached/" rel="nofollow">http://www.danga.com/memcached/</a><br />
with clustering -&gt; <a href="http://code.google.com/p/memcached/wiki/FAQ#Cluster_Architecture_Questions" rel="nofollow">http://code.google.com/p/memcached/wiki/FAQ#Cluster_Architecture_Questions</a></p>
<p>to at some determined thingy(technical term) move the query cached queries to memcached cluster.. Of course dispose of them per thingy as needed by some mid tier thingy doing all this juggling.. I&#8217;ll bet one could get very nice performance..</p>
<p>just a thought..theory.. speculation</p>
]]></content:encoded>
	</item>
</channel>
</rss>
