<?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"
	>
<channel>
	<title>Comments on: Is it query which needs to be optimized ?</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/</link>
	<description>Everything about MySQL Performance</description>
	<pubDate>Tue, 02 Dec 2008 13:50:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Asier Marqués &#187; Blog Archive &#187; Optimizando consultas contra mySql</title>
		<link>http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-115379</link>
		<dc:creator>Asier Marqués &#187; Blog Archive &#187; Optimizando consultas contra mySql</dc:creator>
		<pubDate>Sat, 28 Apr 2007 20:10:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-115379</guid>
		<description>[...] en el archivo del blog ruso mysqlperformanceblog.com, encuentro éste post con consejos sobre cómo optimizar consultas count(), group by y order [...]</description>
		<content:encoded><![CDATA[<p>[...] en el archivo del blog ruso mysqlperformanceblog.com, encuentro éste post con consejos sobre cómo optimizar consultas count(), group by y order [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-73338</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Wed, 07 Mar 2007 20:49:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-73338</guid>
		<description>Cesar, 

Planing table growth is of course typical mistake  however designing schema without looking at the queries is the other one.   The same data may need to be set out different ways depending on which queries you're going to run, of course if high performance is the goal.  A lot of queries out where fail because schemas based on Object relationships and ER diagrams can't run them efficiently as is.</description>
		<content:encoded><![CDATA[<p>Cesar, </p>
<p>Planing table growth is of course typical mistake  however designing schema without looking at the queries is the other one.   The same data may need to be set out different ways depending on which queries you&#8217;re going to run, of course if high performance is the goal.  A lot of queries out where fail because schemas based on Object relationships and ER diagrams can&#8217;t run them efficiently as is.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cesar</title>
		<link>http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-73305</link>
		<dc:creator>Cesar</dc:creator>
		<pubDate>Wed, 07 Mar 2007 20:21:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-73305</guid>
		<description>About "design schema first", I think that's the way to do it. 
But where people is missing is to plan the table growth and sizes. That's where they fail.</description>
		<content:encoded><![CDATA[<p>About &#8220;design schema first&#8221;, I think that&#8217;s the way to do it.<br />
But where people is missing is to plan the table growth and sizes. That&#8217;s where they fail.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-73232</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Wed, 07 Mar 2007 18:34:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-73232</guid>
		<description>Thanks Jay, 

Regarding your comment about SQL_NO_CACHE you're right however you should know what "quickly" really means.  Is invalidation once per second is quickly ?   Well it is if you only run same query once during this time but if you have 5.000 queries/sec and  lets say 100 are same even with so frequent invalidation query cache may be worth it. 

Also in many cases I see summary tables updated periodically rather than on every update.

But anyway you may often do better by caching stuff in memcache :)</description>
		<content:encoded><![CDATA[<p>Thanks Jay, </p>
<p>Regarding your comment about SQL_NO_CACHE you&#8217;re right however you should know what &#8220;quickly&#8221; really means.  Is invalidation once per second is quickly ?   Well it is if you only run same query once during this time but if you have 5.000 queries/sec and  lets say 100 are same even with so frequent invalidation query cache may be worth it. </p>
<p>Also in many cases I see summary tables updated periodically rather than on every update.</p>
<p>But anyway you may often do better by caching stuff in memcache <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay Pipes</title>
		<link>http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-73215</link>
		<dc:creator>Jay Pipes</dc:creator>
		<pubDate>Wed, 07 Mar 2007 18:21:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-73215</guid>
		<description>Great stuff, and an excellent point about MyISAM/InnoDB COUNT(*):  The MyISAM benefit only comes into play when there's no WHERE condition, no when there is! :)

One other quick tip:

If you do use a denormalized structure and use summary tables to store often-queried COUNTs and SUMs and the like, make sure you use SELECT SQL_NO_CACHE ... FROM my_summary_table; to prevent the query cache from storing results for data that will be very quickly invalidated.

Cheers, and keep up the fantastic work, PeterZ! :)</description>
		<content:encoded><![CDATA[<p>Great stuff, and an excellent point about MyISAM/InnoDB COUNT(*):  The MyISAM benefit only comes into play when there&#8217;s no WHERE condition, no when there is! <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>One other quick tip:</p>
<p>If you do use a denormalized structure and use summary tables to store often-queried COUNTs and SUMs and the like, make sure you use SELECT SQL_NO_CACHE &#8230; FROM my_summary_table; to prevent the query cache from storing results for data that will be very quickly invalidated.</p>
<p>Cheers, and keep up the fantastic work, PeterZ! <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-72993</link>
		<dc:creator>Xaprb</dc:creator>
		<pubDate>Wed, 07 Mar 2007 13:20:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-72993</guid>
		<description>I have had similar cases in my consulting too.  I just recently wrote an article about it: http://www.oreillynet.com/pub/a/mysql/2007/03/01/optimize-mysql-rank-data.html</description>
		<content:encoded><![CDATA[<p>I have had similar cases in my consulting too.  I just recently wrote an article about it: <a href="http://www.oreillynet.com/pub/a/mysql/2007/03/01/optimize-mysql-rank-data.html" rel="nofollow">http://www.oreillynet.com/pub/a/mysql/2007/03/01/optimize-mysql-rank-data.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-72752</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Wed, 07 Mar 2007 09:53:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-72752</guid>
		<description>Lukas, 

Actually in this case I meant normalization, you're however right for many very queries data denormalization is what actually help. 

Let me give you an example.  Assume someone has Denormalized schema of Cities which contains rows   (City,State,Country,Population).    Now to diplay list of cities one may do SELECT DISTINCT City from Cities,  which is same as select City from Cities  group by City.   Now assume you want to display  countries but you want to display top Countires by population you may do SELECT Country,sum(population) pop  from Cities group by Country order by pop desc limit 10 but if you would normalize your data you could simply store list of countries separately and just add country population field to the table.</description>
		<content:encoded><![CDATA[<p>Lukas, </p>
<p>Actually in this case I meant normalization, you&#8217;re however right for many very queries data denormalization is what actually help. </p>
<p>Let me give you an example.  Assume someone has Denormalized schema of Cities which contains rows   (City,State,Country,Population).    Now to diplay list of cities one may do SELECT DISTINCT City from Cities,  which is same as select City from Cities  group by City.   Now assume you want to display  countries but you want to display top Countires by population you may do SELECT Country,sum(population) pop  from Cities group by Country order by pop desc limit 10 but if you would normalize your data you could simply store list of countries separately and just add country population field to the table.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lukas</title>
		<link>http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-72735</link>
		<dc:creator>Lukas</dc:creator>
		<pubDate>Wed, 07 Mar 2007 09:17:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/03/06/is-it-query-which-needs-to-be-optimized/#comment-72735</guid>
		<description>"From Schema Design standpoint it is best to make sure your most frequent queries do not need GROUP BY. It can be reachable by normalization or other techniques."

Is that a typo and you meant to say "denormalization"?</description>
		<content:encoded><![CDATA[<p>&#8220;From Schema Design standpoint it is best to make sure your most frequent queries do not need GROUP BY. It can be reachable by normalization or other techniques.&#8221;</p>
<p>Is that a typo and you meant to say &#8220;denormalization&#8221;?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
