<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: A case study in profiling queries in MySQL</title>
	<link>http://www.xaprb.com/blog/2006/10/15/a-case-study-in-profiling-queries-in-mysql/</link>
	<description>Stay curious!</description>
	<pubDate>Fri, 08 Aug 2008 18:57:06 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>

	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/10/15/a-case-study-in-profiling-queries-in-mysql/#comment-5655</link>
		<author>Xaprb</author>
		<pubDate>Wed, 11 Apr 2007 18:18:31 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/15/a-case-study-in-profiling-queries-in-mysql/#comment-5655</guid>
		<description>&lt;p&gt;Use EXPLAIN for that.  But in MySQL, as in any system I've used, this is just an estimate and can be wildly wrong.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Use EXPLAIN for that.  But in MySQL, as in any system I&#8217;ve used, this is just an estimate and can be wildly wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://www.xaprb.com/blog/2006/10/15/a-case-study-in-profiling-queries-in-mysql/#comment-5644</link>
		<author>David</author>
		<pubDate>Wed, 11 Apr 2007 17:36:57 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/15/a-case-study-in-profiling-queries-in-mysql/#comment-5644</guid>
		<description>&lt;p&gt;Excellent blog! have a quick question: is there a way to perform a query performance estimation beforehand? such as the time will take to execute a certain SQL statement, so one can make a decision of running the query online or offline in the background.
Thanks,

David&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Excellent blog! have a quick question: is there a way to perform a query performance estimation beforehand? such as the time will take to execute a certain SQL statement, so one can make a decision of running the query online or offline in the background.<br />
Thanks,</p>
<p>David</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/10/15/a-case-study-in-profiling-queries-in-mysql/#comment-2530</link>
		<author>Xaprb</author>
		<pubDate>Sun, 19 Nov 2006 01:48:42 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/15/a-case-study-in-profiling-queries-in-mysql/#comment-2530</guid>
		<description>&lt;p&gt;The easiest way to measure the time is to use the unix &lt;code&gt;time&lt;/code&gt; program.  MySQL doesn't have scripts, it just takes input.  I usually name my scripts with a .sql suffix.  You can just put the output of a file into the mysql program, like so:&lt;/p&gt;

&lt;pre&gt;time mysql &#60; test.sql&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>The easiest way to measure the time is to use the unix <code>time</code> program.  MySQL doesn&#8217;t have scripts, it just takes input.  I usually name my scripts with a .sql suffix.  You can just put the output of a file into the mysql program, like so:</p>
<pre>time mysql &lt; test.sql</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Niloofar</title>
		<link>http://www.xaprb.com/blog/2006/10/15/a-case-study-in-profiling-queries-in-mysql/#comment-2528</link>
		<author>Niloofar</author>
		<pubDate>Sat, 18 Nov 2006 23:41:00 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/15/a-case-study-in-profiling-queries-in-mysql/#comment-2528</guid>
		<description>&lt;p&gt;Hi,
I connect to mysql version 5.1,
could you tell me what is the easiest way to measure time of a set of queries (with more precision than seconds).&lt;/p&gt;

&lt;p&gt;how could I run a script in mysql (and what is the file suffix of mysql 
scripts)?&lt;/p&gt;

&lt;p&gt;I appreciate if you could respond quickly
Thanks a lot&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I connect to mysql version 5.1,<br />
could you tell me what is the easiest way to measure time of a set of queries (with more precision than seconds).</p>
<p>how could I run a script in mysql (and what is the file suffix of mysql<br />
scripts)?</p>
<p>I appreciate if you could respond quickly<br />
Thanks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/10/15/a-case-study-in-profiling-queries-in-mysql/#comment-2204</link>
		<author>Xaprb</author>
		<pubDate>Mon, 16 Oct 2006 12:47:53 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/15/a-case-study-in-profiling-queries-in-mysql/#comment-2204</guid>
		<description>&lt;p&gt;Right -- that's why the second query appears to read no data.  I should have mentioned that I was taking the "warm up the server first" approach.  I ran each query once before measuring it, to "warm up" the buffer pool.&lt;/p&gt;

&lt;p&gt;Of course, whether this is more realistic or not depends on your data and how you have the server configured.  In an environment with large amounts of data, this is unrealistic, because the rows are not likely to be cached.  But the first query suffered anyway because not all the rows could fit in the cache.  "Warming up the server" didn't benefit the first query.  This would be more realistic for a server with a small dataset.&lt;/p&gt;

&lt;p&gt;Another thing I didn't really make clear is that I ran these tests on a quiet server.  If it were a busy server, the rows might be flushed from the buffer pool by other queries, so even the second query would probably have to read some data from the disk.&lt;/p&gt;

&lt;p&gt;Thank you for pointing this out.  I had that nagging "I'm not really doing this right" feeling in the back of my head, but did not notice.  I will re-do this with a shutdown just before each query, and post those results as well.  That way we can see the difference between the two methods.&lt;/p&gt;

&lt;p&gt;(Update: the next article in the series goes into more detail)&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Right &#8212; that&#8217;s why the second query appears to read no data.  I should have mentioned that I was taking the &#8220;warm up the server first&#8221; approach.  I ran each query once before measuring it, to &#8220;warm up&#8221; the buffer pool.</p>
<p>Of course, whether this is more realistic or not depends on your data and how you have the server configured.  In an environment with large amounts of data, this is unrealistic, because the rows are not likely to be cached.  But the first query suffered anyway because not all the rows could fit in the cache.  &#8220;Warming up the server&#8221; didn&#8217;t benefit the first query.  This would be more realistic for a server with a small dataset.</p>
<p>Another thing I didn&#8217;t really make clear is that I ran these tests on a quiet server.  If it were a busy server, the rows might be flushed from the buffer pool by other queries, so even the second query would probably have to read some data from the disk.</p>
<p>Thank you for pointing this out.  I had that nagging &#8220;I&#8217;m not really doing this right&#8221; feeling in the back of my head, but did not notice.  I will re-do this with a shutdown just before each query, and post those results as well.  That way we can see the difference between the two methods.</p>
<p>(Update: the next article in the series goes into more detail)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Benoit St-Jean</title>
		<link>http://www.xaprb.com/blog/2006/10/15/a-case-study-in-profiling-queries-in-mysql/#comment-2202</link>
		<author>Benoit St-Jean</author>
		<pubDate>Mon, 16 Oct 2006 12:21:52 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/10/15/a-case-study-in-profiling-queries-in-mysql/#comment-2202</guid>
		<description>&lt;p&gt;One thing that could affect your results is the fact that you don't mention shutting down the server between the two measures.  At the second execution of the query, most rows are probably cached in the buffer pool.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>One thing that could affect your results is the fact that you don&#8217;t mention shutting down the server between the two measures.  At the second execution of the query, most rows are probably cached in the buffer pool.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
