<?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 fast can you sort data with MySQL ?</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/</link>
	<description>Everything about MySQL Performance</description>
	<lastBuildDate>Sat, 21 Nov 2009 05:23:57 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: michael.ma的奋斗人生 &#187; Blog Archive &#187; （转贴）根据status信息对MySQL服务器进行优化</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/comment-page-1/#comment-625576</link>
		<dc:creator>michael.ma的奋斗人生 &#187; Blog Archive &#187; （转贴）根据status信息对MySQL服务器进行优化</dc:creator>
		<pubDate>Fri, 07 Aug 2009 06:39:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/#comment-625576</guid>
		<description>[...] Sort_merge_passes 包括两步。MySQL 首先会尝试在内存中做排序，使用的内存大小由系统变量 Sort_buffer_size 决定，如果它的大小不够把所有的记录都读到内存中，MySQL 就会把每次在内存中排序的结果存到临时文件中，等 MySQL 找到所有记录之后，再把临时文件中的记录做一次排序。这再次排序就会增加 Sort_merge_passes。实际上，MySQL 会用另一个临时文件来存再次排序的结果，所以通常会看到 Sort_merge_passes 增加的数值是建临时文件数的两倍。因为用到了临时文件，所以速度可能会比较慢，增加 Sort_buffer_size 会减少 Sort_merge_passes 和 创建临时文件的次数。但盲目的增加 Sort_buffer_size 并不一定能提高速度，见 How fast can you sort data with MySQL?（引自http://qroom.blogspot.com/2007/09/mysql-select-sort.html，貌似被墙） [...]</description>
		<content:encoded><![CDATA[<p>[...] Sort_merge_passes 包括两步。MySQL 首先会尝试在内存中做排序，使用的内存大小由系统变量 Sort_buffer_size 决定，如果它的大小不够把所有的记录都读到内存中，MySQL 就会把每次在内存中排序的结果存到临时文件中，等 MySQL 找到所有记录之后，再把临时文件中的记录做一次排序。这再次排序就会增加 Sort_merge_passes。实际上，MySQL 会用另一个临时文件来存再次排序的结果，所以通常会看到 Sort_merge_passes 增加的数值是建临时文件数的两倍。因为用到了临时文件，所以速度可能会比较慢，增加 Sort_buffer_size 会减少 Sort_merge_passes 和 创建临时文件的次数。但盲目的增加 Sort_buffer_size 并不一定能提高速度，见 How fast can you sort data with MySQL?（引自http://qroom.blogspot.com/2007/09/mysql-select-sort.html，貌似被墙） [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 根据status信息对MySQL服务器进行优化（二） &#187; 超群.com的博客</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/comment-page-1/#comment-518208</link>
		<dc:creator>根据status信息对MySQL服务器进行优化（二） &#187; 超群.com的博客</dc:creator>
		<pubDate>Wed, 25 Mar 2009 07:08:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/#comment-518208</guid>
		<description>[...] Sort_merge_passes 包括两步。MySQL 首先会尝试在内存中做排序，使用的内存大小由系统变量 Sort_buffer_size 决定，如果它的大小不够把所有的记录都读到内存中，MySQL 就会把每次在内存中排序的结果存到临时文件中，等 MySQL 找到所有记录之后，再把临时文件中的记录做一次排序。这再次排序就会增加 Sort_merge_passes。实际上，MySQL 会用另一个临时文件来存再次排序的结果，所以通常会看到 Sort_merge_passes 增加的数值是建临时文件数的两倍。因为用到了临时文件，所以速度可能会比较慢，增加 Sort_buffer_size 会减少 Sort_merge_passes 和 创建临时文件的次数。但盲目的增加 Sort_buffer_size 并不一定能提高速度，见 How fast can you sort data with MySQL?（引自http://qroom.blogspot.com/2007/09/mysql-select-sort.html，貌似被墙） [...]</description>
		<content:encoded><![CDATA[<p>[...] Sort_merge_passes 包括两步。MySQL 首先会尝试在内存中做排序，使用的内存大小由系统变量 Sort_buffer_size 决定，如果它的大小不够把所有的记录都读到内存中，MySQL 就会把每次在内存中排序的结果存到临时文件中，等 MySQL 找到所有记录之后，再把临时文件中的记录做一次排序。这再次排序就会增加 Sort_merge_passes。实际上，MySQL 会用另一个临时文件来存再次排序的结果，所以通常会看到 Sort_merge_passes 增加的数值是建临时文件数的两倍。因为用到了临时文件，所以速度可能会比较慢，增加 Sort_buffer_size 会减少 Sort_merge_passes 和 创建临时文件的次数。但盲目的增加 Sort_buffer_size 并不一定能提高速度，见 How fast can you sort data with MySQL?（引自http://qroom.blogspot.com/2007/09/mysql-select-sort.html，貌似被墙） [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Project 2061 Techlog &#187; Optimizing MySQL Server Runtime Parameters</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/comment-page-1/#comment-296421</link>
		<dc:creator>Project 2061 Techlog &#187; Optimizing MySQL Server Runtime Parameters</dc:creator>
		<pubDate>Wed, 07 May 2008 18:55:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/#comment-296421</guid>
		<description>[...] MySQL Performance Blog: How fast can you sort data with MySQL? [...]</description>
		<content:encoded><![CDATA[<p>[...] MySQL Performance Blog: How fast can you sort data with MySQL? [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/comment-page-1/#comment-171970</link>
		<dc:creator>Justin</dc:creator>
		<pubDate>Tue, 25 Sep 2007 05:31:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/#comment-171970</guid>
		<description>Further to my last question..

As described in this blog post, a table scan with order by/limit does a very fast sort if you want to get the top-most rows .. but I find it useless if you want to use it to create a full ordered insert (for example) for innodb.
My large table spends hours &#039;sorting result&#039;, even though I can get top 20 results within 15 minutes. I wonder if there are some short-cuts taken by mysql where limit is used. Perhaps a table-scan, with a running best-of list, for example. That would not then be a sort, would it?

In order to do an ordered bulk insert to innodb by PK I am resorting to external sort of a file with unix sort then feeding it with batch inserts, rather than feeding it to myisam then converting, or feeding to myisam then sort .. order by .. insert, or feeding un-ordered PK to innodb directly then doing alter table engine=innodb to &quot;defragment&quot; PK.

Am I on the right track?</description>
		<content:encoded><![CDATA[<p>Further to my last question..</p>
<p>As described in this blog post, a table scan with order by/limit does a very fast sort if you want to get the top-most rows .. but I find it useless if you want to use it to create a full ordered insert (for example) for innodb.<br />
My large table spends hours &#8217;sorting result&#8217;, even though I can get top 20 results within 15 minutes. I wonder if there are some short-cuts taken by mysql where limit is used. Perhaps a table-scan, with a running best-of list, for example. That would not then be a sort, would it?</p>
<p>In order to do an ordered bulk insert to innodb by PK I am resorting to external sort of a file with unix sort then feeding it with batch inserts, rather than feeding it to myisam then converting, or feeding to myisam then sort .. order by .. insert, or feeding un-ordered PK to innodb directly then doing alter table engine=innodb to &#8220;defragment&#8221; PK.</p>
<p>Am I on the right track?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/comment-page-1/#comment-171897</link>
		<dc:creator>Justin</dc:creator>
		<pubDate>Tue, 25 Sep 2007 02:04:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/#comment-171897</guid>
		<description>On this subject.. if you have a huge un-ordered myisam table and wish to get it into sort order before dumping it to INNODB, which is going to be faster?

a) Add an index on column to be sorted and select by that index
b) Dump the data to flat file and sort using unix sort then re-import
c) Select using table-scan and sort as per your example
d) alter to innodb with primary key (which is the objective anyway)

I&#039;m currently doing (a) but I&#039;m wondering if this is a big waste of time.</description>
		<content:encoded><![CDATA[<p>On this subject.. if you have a huge un-ordered myisam table and wish to get it into sort order before dumping it to INNODB, which is going to be faster?</p>
<p>a) Add an index on column to be sorted and select by that index<br />
b) Dump the data to flat file and sort using unix sort then re-import<br />
c) Select using table-scan and sort as per your example<br />
d) alter to innodb with primary key (which is the objective anyway)</p>
<p>I&#8217;m currently doing (a) but I&#8217;m wondering if this is a big waste of time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/comment-page-1/#comment-169796</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Wed, 19 Sep 2007 10:20:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/#comment-169796</guid>
		<description>Lachlan,

Indeed it can affect things.  And there are more variables like table structure of course - I have not tested these yet.</description>
		<content:encoded><![CDATA[<p>Lachlan,</p>
<p>Indeed it can affect things.  And there are more variables like table structure of course &#8211; I have not tested these yet.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lachlan Mulcahy</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/comment-page-1/#comment-169703</link>
		<dc:creator>Lachlan Mulcahy</dc:creator>
		<pubDate>Wed, 19 Sep 2007 05:40:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/#comment-169703</guid>
		<description>Hi Peter,

I wonder how the size of this buffer would affect real loaded systems?

Obviously on many real systems disk IO comes into the equation and then disk seek time can start playing a big factor. 

I would be interested to see if the results change in this kind of situation.

Kind Regards,
Lachlan</description>
		<content:encoded><![CDATA[<p>Hi Peter,</p>
<p>I wonder how the size of this buffer would affect real loaded systems?</p>
<p>Obviously on many real systems disk IO comes into the equation and then disk seek time can start playing a big factor. </p>
<p>I would be interested to see if the results change in this kind of situation.</p>
<p>Kind Regards,<br />
Lachlan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MySQL Performance Blog &#187; MySQL: what read_buffer_size value is optimal ?</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/comment-page-1/#comment-169054</link>
		<dc:creator>MySQL Performance Blog &#187; MySQL: what read_buffer_size value is optimal ?</dc:creator>
		<pubDate>Mon, 17 Sep 2007 14:41:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/#comment-169054</guid>
		<description>[...] benchmarks and performance research. I just recently wrote about rather surprising results with sort performance and today I&#039;ve discovered even read_buffer_size selection may be less than [...]</description>
		<content:encoded><![CDATA[<p>[...] benchmarks and performance research. I just recently wrote about rather surprising results with sort performance and today I&#8217;ve discovered even read_buffer_size selection may be less than [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Day</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/comment-page-1/#comment-165000</link>
		<dc:creator>James Day</dc:creator>
		<pubDate>Sat, 08 Sep 2007 00:27:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/#comment-165000</guid>
		<description>Scott, an index that can satisfy both the WHERE and ORDER BY clauses can be expected to eliminate the need to sort.

Whitesites, larger buffers often still do help performance on mixed query loads but what this does show is that if you can have the default low and increase it only in the sessions that benefit from larger sizes you can get the best of both worlds. As you optimise queries and indexes you can also find that the optimal value for a particular workload changes.</description>
		<content:encoded><![CDATA[<p>Scott, an index that can satisfy both the WHERE and ORDER BY clauses can be expected to eliminate the need to sort.</p>
<p>Whitesites, larger buffers often still do help performance on mixed query loads but what this does show is that if you can have the default low and increase it only in the sessions that benefit from larger sizes you can get the best of both worlds. As you optimise queries and indexes you can also find that the optimal value for a particular workload changes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: whitesites</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/comment-page-1/#comment-163909</link>
		<dc:creator>whitesites</dc:creator>
		<pubDate>Wed, 05 Sep 2007 19:38:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/18/how-fast-can-you-sort-data-with-mysql/#comment-163909</guid>
		<description>Awesome article.  Its interesting to find that giving mysql more memory does not help performance.  This is totally opposite to what many believe.  I am sure this is a result of the amount of System Cache available to mysql.  Makes alot of sense considering intel has been moving away from high CPU speeds to beefed up 4, 6 and 8 MB cache with multiple cores.  I would be curious to see what the speed improvement is when using one of these beefed up chips.</description>
		<content:encoded><![CDATA[<p>Awesome article.  Its interesting to find that giving mysql more memory does not help performance.  This is totally opposite to what many believe.  I am sure this is a result of the amount of System Cache available to mysql.  Makes alot of sense considering intel has been moving away from high CPU speeds to beefed up 4, 6 and 8 MB cache with multiple cores.  I would be curious to see what the speed improvement is when using one of these beefed up chips.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
