<?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 Query Cache</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/</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: Straw Man</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/comment-page-2/#comment-843674</link>
		<dc:creator>Straw Man</dc:creator>
		<pubDate>Sun, 20 Nov 2011 02:53:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/#comment-843674</guid>
		<description>I&#039;m new to all this SQL stuff and wish I had enough knowledge to read and comprehend everything you are saying, however, if you would be so kind and point me in the right direction of a good &quot;beginner&#039;s SQL boo&quot; I would really appreciate it?  
Consider me the straw-man from the Wizard of Oz.... the government does. (mentally full of hay but willing to learn).  Thanks</description>
		<content:encoded><![CDATA[<p>I&#8217;m new to all this SQL stuff and wish I had enough knowledge to read and comprehend everything you are saying, however, if you would be so kind and point me in the right direction of a good &#8220;beginner&#8217;s SQL boo&#8221; I would really appreciate it?<br />
Consider me the straw-man from the Wizard of Oz&#8230;. the government does. (mentally full of hay but willing to learn).  Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kalpesh</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/comment-page-2/#comment-836259</link>
		<dc:creator>Kalpesh</dc:creator>
		<pubDate>Wed, 02 Nov 2011 14:28:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/#comment-836259</guid>
		<description>Hello Peter

First of all thank a lot for putting this website together, I have referenced your material many times to solve issues and it has worked always.

I have following query in my application, and noticed that data is not cached at all. I checked all the settings and my settings says it should be cached.

Only thing I can think of now is, this SQL may be &quot;complex&quot; and that is the reason its not cached by MySQL. So is there any other option to cache it &quot;force cache&quot; ?


************************************************************************************************************
select 		ea.string_value 
			, cast((e.DATE - interval weekday(e.DATE) day) as date) AS WeekStart
			, (count(0) /sum(e.ITEM_COUNT)*100) AS Percent 
from  db_three.table1 en 
join db_one.table2  ea on ea.en_id=en.id and (&#039;0&#039;=&#039;0&#039; or `en`.Id in (0))  
join db_one.table3 a on a.id =1 and a.id = ea.id  
join db_two.table4 on table4.TYPE = &#039;DATA_SOURCE_TYPE&#039;  
join db_two.table5 e on e.object_name = en.object_name 
			and e.date&gt;&#039;2001-01-01&#039; 
			and e.table4_type_id = table4.ID 
Group by 1,2 
Order by 2,1 

************************************************************************************************************


Show variables like %cache%;
******************************************
Binlog_cache_disk_use, 0
Binlog_cache_use, 0
Com_assign_to_keycache, 0
Qcache_free_blocks, 1
Qcache_free_memory, 536834160
Qcache_hits, 0
Qcache_inserts, 2
Qcache_lowmem_prunes, 0
Qcache_not_cached, 15
Qcache_queries_in_cache, 2
Qcache_total_blocks, 11
Ssl_callback_cache_hits, 0
Ssl_session_cache_hits, 0
Ssl_session_cache_misses, 0
Ssl_session_cache_mode, NONE
Ssl_session_cache_overflows, 0
Ssl_session_cache_size, 0
Ssl_session_cache_timeouts, 0
Ssl_used_session_cache_entries, 0
Threads_cached, 0
******************************************</description>
		<content:encoded><![CDATA[<p>Hello Peter</p>
<p>First of all thank a lot for putting this website together, I have referenced your material many times to solve issues and it has worked always.</p>
<p>I have following query in my application, and noticed that data is not cached at all. I checked all the settings and my settings says it should be cached.</p>
<p>Only thing I can think of now is, this SQL may be &#8220;complex&#8221; and that is the reason its not cached by MySQL. So is there any other option to cache it &#8220;force cache&#8221; ?</p>
<p>************************************************************************************************************<br />
select 		ea.string_value<br />
			, cast((e.DATE &#8211; interval weekday(e.DATE) day) as date) AS WeekStart<br />
			, (count(0) /sum(e.ITEM_COUNT)*100) AS Percent<br />
from  db_three.table1 en<br />
join db_one.table2  ea on ea.en_id=en.id and (&#8217;0&#8242;=&#8217;0&#8242; or `en`.Id in (0))<br />
join db_one.table3 a on a.id =1 and a.id = ea.id<br />
join db_two.table4 on table4.TYPE = &#8216;DATA_SOURCE_TYPE&#8217;<br />
join db_two.table5 e on e.object_name = en.object_name<br />
			and e.date&gt;&#8217;2001-01-01&#8242;<br />
			and e.table4_type_id = table4.ID<br />
Group by 1,2<br />
Order by 2,1 </p>
<p>************************************************************************************************************</p>
<p>Show variables like %cache%;<br />
******************************************<br />
Binlog_cache_disk_use, 0<br />
Binlog_cache_use, 0<br />
Com_assign_to_keycache, 0<br />
Qcache_free_blocks, 1<br />
Qcache_free_memory, 536834160<br />
Qcache_hits, 0<br />
Qcache_inserts, 2<br />
Qcache_lowmem_prunes, 0<br />
Qcache_not_cached, 15<br />
Qcache_queries_in_cache, 2<br />
Qcache_total_blocks, 11<br />
Ssl_callback_cache_hits, 0<br />
Ssl_session_cache_hits, 0<br />
Ssl_session_cache_misses, 0<br />
Ssl_session_cache_mode, NONE<br />
Ssl_session_cache_overflows, 0<br />
Ssl_session_cache_size, 0<br />
Ssl_session_cache_timeouts, 0<br />
Ssl_used_session_cache_entries, 0<br />
Threads_cached, 0<br />
******************************************</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Akhthar</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/comment-page-2/#comment-832674</link>
		<dc:creator>Akhthar</dc:creator>
		<pubDate>Thu, 20 Oct 2011 08:56:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/#comment-832674</guid>
		<description>I think the Query cache won&#039;t be able to use the free memory available (Qcache_free_memory), if there are too many fragmented blocks (Qcache_free_blocks), right? And I believe this happens when Qcache_free_blocks becomes too much for Qcache to make any useful blocks out of free memory.

root@server [~]# date;mysqladmin ext&#124;awk &#039;/Qcache/ &amp;&amp; /free_blocks/ &#124;&#124; /free_memory/ &#124;&#124; /lowmem_prunes/&#039;
Thu Oct 20 03:42:03 EDT 2011
&#124; Qcache_free_blocks                &#124; 117773      &#124;
&#124; Qcache_free_memory                &#124; 147256440   &#124;
&#124; Qcache_lowmem_prunes              &#124; 1849687     &#124;

root@server [~]# date;mysqladmin ext&#124;awk &#039;/Qcache/ &amp;&amp; /free_blocks/ &#124;&#124; /free_memory/ &#124;&#124; /lowmem_prunes/&#039;
Thu Oct 20 03:42:06 EDT 2011
&#124; Qcache_free_blocks                &#124; 117694      &#124;
&#124; Qcache_free_memory                &#124; 147396720   &#124;
&#124; Qcache_lowmem_prunes              &#124; 1849719     &#124;

As you can see the Qcache pruning due to low memory occurs even when there are around 140M+ free memory in Qcache.</description>
		<content:encoded><![CDATA[<p>I think the Query cache won&#8217;t be able to use the free memory available (Qcache_free_memory), if there are too many fragmented blocks (Qcache_free_blocks), right? And I believe this happens when Qcache_free_blocks becomes too much for Qcache to make any useful blocks out of free memory.</p>
<p>root@server [~]# date;mysqladmin ext|awk &#8216;/Qcache/ &amp;&amp; /free_blocks/ || /free_memory/ || /lowmem_prunes/&#8217;<br />
Thu Oct 20 03:42:03 EDT 2011<br />
| Qcache_free_blocks                | 117773      |<br />
| Qcache_free_memory                | 147256440   |<br />
| Qcache_lowmem_prunes              | 1849687     |</p>
<p>root@server [~]# date;mysqladmin ext|awk &#8216;/Qcache/ &amp;&amp; /free_blocks/ || /free_memory/ || /lowmem_prunes/&#8217;<br />
Thu Oct 20 03:42:06 EDT 2011<br />
| Qcache_free_blocks                | 117694      |<br />
| Qcache_free_memory                | 147396720   |<br />
| Qcache_lowmem_prunes              | 1849719     |</p>
<p>As you can see the Qcache pruning due to low memory occurs even when there are around 140M+ free memory in Qcache.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leo</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/comment-page-2/#comment-807538</link>
		<dc:creator>Leo</dc:creator>
		<pubDate>Tue, 26 Jul 2011 20:41:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/#comment-807538</guid>
		<description>Good article. Can you post one on memcached?

Thanks.</description>
		<content:encoded><![CDATA[<p>Good article. Can you post one on memcached?</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sudheer</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/comment-page-2/#comment-806814</link>
		<dc:creator>Sudheer</dc:creator>
		<pubDate>Wed, 20 Jul 2011 07:51:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/#comment-806814</guid>
		<description>Hi Peter ,

I have one production server on high with 95% on insets and updates commands. Is query_catch help me?
right now on my server query cache values

query_cache_limit = 524288
query_cache_size = 134217728


Qcache_hits/(Com_select+Qcache_hits)=984286623/(984286623+327790129)=0.75 , (Com_insert)/Qcache_hits = (2029732811)/984286623 = 2.0621,(Com_insert+Com_delete+Com_update+Com_replace)/Qcache_hits =(2029732811+166042669+1678664993)/984286623 =3.9363

Variable_name	Value
Qcache_free_blocks	18580
Qcache_free_memory	53059640
Qcache_hits	984929059
Qcache_inserts	36451881
Qcache_lowmem_prunes	1198358
Qcache_not_cached	244851098
Qcache_queries_in_cache	32379
Qcache_total_blocks	83477

Could you please suggest me can I go for query_catch= 0 or any other value?</description>
		<content:encoded><![CDATA[<p>Hi Peter ,</p>
<p>I have one production server on high with 95% on insets and updates commands. Is query_catch help me?<br />
right now on my server query cache values</p>
<p>query_cache_limit = 524288<br />
query_cache_size = 134217728</p>
<p>Qcache_hits/(Com_select+Qcache_hits)=984286623/(984286623+327790129)=0.75 , (Com_insert)/Qcache_hits = (2029732811)/984286623 = 2.0621,(Com_insert+Com_delete+Com_update+Com_replace)/Qcache_hits =(2029732811+166042669+1678664993)/984286623 =3.9363</p>
<p>Variable_name	Value<br />
Qcache_free_blocks	18580<br />
Qcache_free_memory	53059640<br />
Qcache_hits	984929059<br />
Qcache_inserts	36451881<br />
Qcache_lowmem_prunes	1198358<br />
Qcache_not_cached	244851098<br />
Qcache_queries_in_cache	32379<br />
Qcache_total_blocks	83477</p>
<p>Could you please suggest me can I go for query_catch= 0 or any other value?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: white picture frames</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/comment-page-2/#comment-804450</link>
		<dc:creator>white picture frames</dc:creator>
		<pubDate>Wed, 13 Apr 2011 06:17:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/#comment-804450</guid>
		<description>First, in SEO or search engine optimization, part of the algorithm for ranking your page on search engines is determined by the number and quality of backlinks to your site, providing they occur naturally and you have not purchased them.</description>
		<content:encoded><![CDATA[<p>First, in SEO or search engine optimization, part of the algorithm for ranking your page on search engines is determined by the number and quality of backlinks to your site, providing they occur naturally and you have not purchased them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carpii</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/comment-page-2/#comment-795197</link>
		<dc:creator>Carpii</dc:creator>
		<pubDate>Mon, 24 Jan 2011 00:51:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/#comment-795197</guid>
		<description>Pavel,

Sure, for best performance you need to gently guide MySQL as to how best to cache (or not cache things).

If you have queries which you know cannot be cached then tell mysql not to cache them. It might save some reusable query from being evicted from the cache, and will keep your cache hit ratio up (which is a good thing). 

Also for tables which are frequently updated, it might be worth not caching some queries on those tables. When a table is updated MySQL removes all cached queries which reference those tables, from the query cache. It has to do this because it caches on a packet level, so has no real understanding of whether the cached query would be affected by the update or not

Finally, best to avoid caching large batch which run maybe once a day. 
Also for queries which return large result sets but are run infrequently, theres usually little point in caching these either.</description>
		<content:encoded><![CDATA[<p>Pavel,</p>
<p>Sure, for best performance you need to gently guide MySQL as to how best to cache (or not cache things).</p>
<p>If you have queries which you know cannot be cached then tell mysql not to cache them. It might save some reusable query from being evicted from the cache, and will keep your cache hit ratio up (which is a good thing). </p>
<p>Also for tables which are frequently updated, it might be worth not caching some queries on those tables. When a table is updated MySQL removes all cached queries which reference those tables, from the query cache. It has to do this because it caches on a packet level, so has no real understanding of whether the cached query would be affected by the update or not</p>
<p>Finally, best to avoid caching large batch which run maybe once a day.<br />
Also for queries which return large result sets but are run infrequently, theres usually little point in caching these either.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pavel</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/comment-page-2/#comment-794711</link>
		<dc:creator>Pavel</dc:creator>
		<pubDate>Thu, 20 Jan 2011 22:37:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/#comment-794711</guid>
		<description>I noticed that in the Status column is &quot;storing result in query cache&quot; in phpmyadmin of running queries. Some of those will never be reused for sure. From optimization standpoint, does it make sense to run those queries with SQL_NO_CACHE so there is no time spent with storing results or there is no difference?</description>
		<content:encoded><![CDATA[<p>I noticed that in the Status column is &#8220;storing result in query cache&#8221; in phpmyadmin of running queries. Some of those will never be reused for sure. From optimization standpoint, does it make sense to run those queries with SQL_NO_CACHE so there is no time spent with storing results or there is no difference?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laph</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/comment-page-2/#comment-793289</link>
		<dc:creator>Laph</dc:creator>
		<pubDate>Mon, 10 Jan 2011 15:07:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/#comment-793289</guid>
		<description>Within my app, I always saw a high query cache fragmentation (large Qcache_free_blocks) - leading to many lowmem prunes. Raising the query cache size didn&#039;t really help.
Well, I solved this by calculating a better value for query_cache_min_res_unit, using this formula:
(query_cache_size - qcache_free_memory) / qcache_queries_in_cache

This is the average size of a cached query, which was around 2k in my case. Then I changed query_cache_min_res_unit from the default of 4k to 2k and got a much better cache utilization. I could even lower the size again.</description>
		<content:encoded><![CDATA[<p>Within my app, I always saw a high query cache fragmentation (large Qcache_free_blocks) &#8211; leading to many lowmem prunes. Raising the query cache size didn&#8217;t really help.<br />
Well, I solved this by calculating a better value for query_cache_min_res_unit, using this formula:<br />
(query_cache_size &#8211; qcache_free_memory) / qcache_queries_in_cache</p>
<p>This is the average size of a cached query, which was around 2k in my case. Then I changed query_cache_min_res_unit from the default of 4k to 2k and got a much better cache utilization. I could even lower the size again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: partha</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/comment-page-2/#comment-791996</link>
		<dc:creator>partha</dc:creator>
		<pubDate>Wed, 05 Jan 2011 11:19:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/#comment-791996</guid>
		<description>In one of my slave server, the system user shows invalidating query cache(table). Because of this replication getting delayed. Internally what&#039;s happening actually?</description>
		<content:encoded><![CDATA[<p>In one of my slave server, the system user shows invalidating query cache(table). Because of this replication getting delayed. Internally what&#8217;s happening actually?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

