<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EaseMarry Blogs &#187; Mysql</title>
	<atom:link href="http://www.easemarry.com/blog/category/database/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.easemarry.com/blog</link>
	<description>php and java code</description>
	<lastBuildDate>Sun, 09 Aug 2009 16:09:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>mysql backup</title>
		<link>http://www.easemarry.com/blog/mysql-backup/</link>
		<comments>http://www.easemarry.com/blog/mysql-backup/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 04:03:30 +0000</pubDate>
		<dc:creator>rueben</dc:creator>
				<category><![CDATA[DataBase]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[mysql backup]]></category>

		<guid isPermaLink="false">http://www.easemarry.com/blog/mysql-backup/</guid>
		<description><![CDATA[usage
#mysqldump [options] db_name [tables]
#mysqldump [options] &#8211;databases db_name1 [db_name2 db_name3...]
#mysqldump [options] &#8211;all-databases
Example
#mysqldump -u root -p mydatabase &#62; db.sql
Specific table
#mysqldump -u root -p mydatabase -tables customer &#62; db.sql
How to restore database
#mysql -u root -p database &#60; db.sql
If want to restore to specific database
mysql -u root -pMyPassword MyDatabase &#60; db.sql
]]></description>
			<content:encoded><![CDATA[<p>usage</p>
<p>#mysqldump [options] db_name [tables]<br />
#mysqldump [options] &#8211;databases db_name1 [db_name2 db_name3...]<br />
#mysqldump [options] &#8211;all-databases</p>
<p>Example</p>
<p>#mysqldump -u root -p mydatabase &gt; db.sql</p>
<p>Specific table</p>
<p>#mysqldump -u root -p mydatabase -tables customer &gt; db.sql</p>
<p>How to restore database</p>
<p>#mysql -u root -p database &lt; db.sql</p>
<p>If want to restore to specific database</p>
<p>mysql -u root -pMyPassword MyDatabase &lt; db.sql</p>
]]></content:encoded>
			<wfw:commentRss>http://www.easemarry.com/blog/mysql-backup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MYSQL limit Optimization-2</title>
		<link>http://www.easemarry.com/blog/mysql-limit-optimization-2/</link>
		<comments>http://www.easemarry.com/blog/mysql-limit-optimization-2/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 13:02:18 +0000</pubDate>
		<dc:creator>rueben</dc:creator>
				<category><![CDATA[DataBase]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[limit]]></category>
		<category><![CDATA[Optimization]]></category>

		<guid isPermaLink="false">http://www.easemarry.com/blog/mysql-limit-optimization-2/</guid>
		<description><![CDATA[
The MYSQL optimization is very important. Other most commonly used also most need to optimize are limit. mysql limit has brought enormous convenient to the paging, but the data quantity one is big, the limit performance suddenly drops.
Similarly takes 10 data
select * from temp limit 10000,10
and
select * from temp limit 0,10
It is not a quantity rank.
Now [...]]]></description>
			<content:encoded><![CDATA[<p><!--adsense#co-2--><br />
The MYSQL optimization is very important. Other most commonly used also most need to optimize are limit. mysql limit has brought enormous convenient to the paging, but the data quantity one is big, the limit performance suddenly drops.<dnt></dnt></p>
<p>Similarly takes 10 data</p>
<p>select * from temp limit 10000,10<br />
and<br />
select * from temp limit 0,10</p>
<p>It is not a quantity rank.</p>
<p>Now many about limit five optimized criterion, is from the mysql handbook ,You may have a look at this article about Mysql limit:<a href="http://www.easemarry.com/blog/mysql-limit-optimization/">http://www.easemarry.com/blog/mysql-limit-optimization/</a></p>
<p>In the article uses limit directly, but first gains to offset id then uses limit size to gain the data directly. According to his data, is friends with obviously in uses limit directly. Here my concrete service data is divided two kind of situations to carry on the test.</p>
<p>1st, offset small time.<dnt></dnt></p>
<p>select * from temp limit 10,10</p>
<p>Repeatedly running , the time maintains between 0.0004-0.0005</p>
<p>Select * From yanxue8_visit Where vid &gt;=(<br />
Select vid From yanxue8_visit Order By vid limit 10,1<br />
) limit 10</p>
<p>Repeatedly running , the time maintains between 0.0005-0.0006</p>
<p>Conclusion: offset is small, uses limit to be superior directly. This is the sub-inquiry reason obviously.</p>
<p>2nd, offset great time.</p>
<p>select * from temp limit 10000,10</p>
<p>Repeatedly running , the time maintains between 0.0185-0.0190</p>
<p>Select * From yanxue8_visit Where vid &gt;=(<br />
Select vid From yanxue8_visit Order By vid limit 10000,1<br />
) limit 10</p>
<p>Repeatedly running , the time maintains between 0.0061-0.0065,Only the former 1/3. May estimate that offset is bigger, the latter is more superior. <br />
<a href="http://www.easemarry.com/blog">http://www.easemarry.com/blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.easemarry.com/blog/mysql-limit-optimization-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MYSQL limit Optimization</title>
		<link>http://www.easemarry.com/blog/mysql-limit-optimization/</link>
		<comments>http://www.easemarry.com/blog/mysql-limit-optimization/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 12:48:33 +0000</pubDate>
		<dc:creator>rueben</dc:creator>
				<category><![CDATA[DataBase]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[limit]]></category>
		<category><![CDATA[Optimization]]></category>

		<guid isPermaLink="false">http://www.easemarry.com/blog/mysql-limit-optimization/</guid>
		<description><![CDATA[
select * from table LIMIT 5,10; #return to 6-15th line
select * from table LIMIT 5; #return to 0-5 line
select * from table LIMIT 0,5; #return to 0-5 line
 Performance optimization:
In MySQL5.0 limit high performance.
1.
Select * From cyclopedia Where ID&#62;=(
Select Max(ID) From (
 Select ID From cyclopedia Order By ID limit 90001
) As tmp
) limit 100;
2.
Select * From [...]]]></description>
			<content:encoded><![CDATA[<p><!--adsense#co-2--><br />
select * from table LIMIT 5,10; #return to 6-15th line</p>
<p>select * from table LIMIT 5; #return to 0-5 line</p>
<p>select * from table LIMIT 0,5; #return to 0-5 line</p>
<p> Performance optimization:</p>
<p>In MySQL5.0 limit high performance.</p>
<p>1.<br />
Select * From cyclopedia Where ID&gt;=(<br />
Select Max(ID) From (<br />
 Select ID From cyclopedia Order By ID limit 90001<br />
) As tmp<br />
) limit 100;</p>
<p>2.<br />
Select * From cyclopedia Where ID&gt;=(<br />
Select Max(ID) From (<br />
 Select ID From cyclopedia Order By ID limit 90000,1<br />
) As tmp<br />
) limit 100;</p>
<p>Similarly takes 90000 latter 100 records, 1st quickly 2nd quick?<dnt></dnt></p>
<p>1st has preoccupied the first 90001 records, takes is biggest a ID value to take outset marking, then uses it to be possible fast localization next 100 record</p>
<p> <dnt></dnt>2nd to select takes 90000 record latter 1 merely, then takes the ID value to make outset marking localization next 100 record</p>
<p><dnt></dnt>1st to carry out result .100 rows in set (0.23) sec</p>
<p><dnt></dnt>2nd to carry out result .100 rows in set (0.19) sec</p>
<p>Very obvious 2nd wins. Before looking like limit probably looks like me, not completely imagines such makes the entire table scanning to return to limit the offset+length strip record, this way limit compares MS-SQL Top the performance to enhance many.</p>
<p>Actually 2nd definitely may revise:</p>
<p>Select * From cyclopedia Where ID&gt;=(<br />
Select ID From cyclopedia limit 90000,1<br />
)limit 100;</p>
<p>Uses the 90000th record directly ID, does not need to undergo the Max operation, because like this makes theoretically the efficiency this high somewhat, but does not look at the effect nearly in the actual use, because itself locates the ID returns is 1 record, Max does not need the operation to be able nearly to obtain the result.</p>
<p>But, since MySQL has limit to be possible the positive governing to take out the record the position, why not simply uses Select * From cyclopedia limit 90000,1? To be how could it not be more succinct? wanted mistakenly, to try like this to know that the result was: 1 row in set (8.88) sec, what kind, suffices scary, let me remember yesterday compared this in 4.1 also to have &#8221; the high score &#8220;. Select * should better not use casually, must in line with use anything, chooses anything the principle, the Select field to be more, the field data quantity is bigger, the speed is slower. Have above 2 kind of paging mode which kind 1 strong been more than Shan Xiezhei, although looks like the number of times which probably inquires to be more some, but in fact has received in exchange for the highly effective performance by the small price, was worth.</p>
<p>The 1st kind of plan may use in MS-SQL similarly, moreover possibly is best. Because locates the initial sector depending on principal linkage ID to be always quickest.</p>
<p>Select Top 100 * From cyclopedia Where ID&gt;=(<br />
Select Top 90001 Max(ID) From (<br />
 Select ID From cyclopedia Order By ID<br />
) As tmp<br />
)</p>
<p>But no matter realizes the way to PROCEDURE or code, the bottleneck lies in MS-SQL TOP always to throughout return to the first N record, this kind of situation when the data quantity is not big feels not deeply, but if hundred and thousand of ten thousand, the efficiency can definitely be low. Comparatively MySQL limit has superiority many, the execution:</p>
<p>Select ID From cyclopedia limit 90000<br />
Select ID From cyclopedia limit 90000,1</p>
<p>result respectively is:</p>
<p>90000 rows in set (0.36) sec<br />
1 row in set (0.06) sec</p>
<p>But MS-SQL can only use Select Top 90000 ID From the cyclopedia execution time is 390ms, carries out the similar operating time also to be inferior to MySQL 360ms.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.easemarry.com/blog/mysql-limit-optimization/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

