<?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: Tip: faster than TRUNCATE</title>
	<atom:link href="http://code.openark.org/blog/mysql/tip-faster-than-truncate/feed" rel="self" type="application/rss+xml" />
	<link>http://code.openark.org/blog/mysql/tip-faster-than-truncate</link>
	<description>Blog by Shlomi Noach</description>
	<lastBuildDate>Wed, 01 Feb 2012 20:47:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: shlomi</title>
		<link>http://code.openark.org/blog/mysql/tip-faster-than-truncate/comment-page-1#comment-59885</link>
		<dc:creator>shlomi</dc:creator>
		<pubDate>Tue, 22 Nov 2011 07:38:47 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1896#comment-59885</guid>
		<description>@grace,
The RENAME itself should not be affected by number of rows, since it merely maps to a file rename. I say &quot;should&quot; though I&#039;ve renamed very large tables with no overhead.</description>
		<content:encoded><![CDATA[<p>@grace,<br />
The RENAME itself should not be affected by number of rows, since it merely maps to a file rename. I say "should" though I've renamed very large tables with no overhead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: grace</title>
		<link>http://code.openark.org/blog/mysql/tip-faster-than-truncate/comment-page-1#comment-59883</link>
		<dc:creator>grace</dc:creator>
		<pubDate>Tue, 22 Nov 2011 07:22:06 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1896#comment-59883</guid>
		<description>hey shlomi,

just want to ask if number of records in the table affects renaming table performance?</description>
		<content:encoded><![CDATA[<p>hey shlomi,</p>
<p>just want to ask if number of records in the table affects renaming table performance?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shlomi</title>
		<link>http://code.openark.org/blog/mysql/tip-faster-than-truncate/comment-page-1#comment-11334</link>
		<dc:creator>shlomi</dc:creator>
		<pubDate>Wed, 10 Mar 2010 16:09:17 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1896#comment-11334</guid>
		<description>@Hans,
Well, I would do well with 8-10 seconds. However, as I described, I waited for long minutes. Connections got into Locked state. Nothing would happen (on one occasion I waited for 15 minutes before calling it off).</description>
		<content:encoded><![CDATA[<p>@Hans,<br />
Well, I would do well with 8-10 seconds. However, as I described, I waited for long minutes. Connections got into Locked state. Nothing would happen (on one occasion I waited for 15 minutes before calling it off).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans-Henrik</title>
		<link>http://code.openark.org/blog/mysql/tip-faster-than-truncate/comment-page-1#comment-11332</link>
		<dc:creator>Hans-Henrik</dc:creator>
		<pubDate>Wed, 10 Mar 2010 13:46:38 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1896#comment-11332</guid>
		<description>The big difference, i think is the time the table &#039;log_table&#039; is unavailable.

If you truncate, the table will be locked until the space has been freed (8-10 seconds for _very_ large tables, if you have IO at the same time). If you do the renaming first, the empty table will appear _very_ fast, while the dropping of the old table does not involve locking of any table that is in use, and so - probably doesn&#039;t matter much if it takes a few seconds.</description>
		<content:encoded><![CDATA[<p>The big difference, i think is the time the table 'log_table' is unavailable.</p>
<p>If you truncate, the table will be locked until the space has been freed (8-10 seconds for _very_ large tables, if you have IO at the same time). If you do the renaming first, the empty table will appear _very_ fast, while the dropping of the old table does not involve locking of any table that is in use, and so - probably doesn't matter much if it takes a few seconds.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shlomi</title>
		<link>http://code.openark.org/blog/mysql/tip-faster-than-truncate/comment-page-1#comment-11328</link>
		<dc:creator>shlomi</dc:creator>
		<pubDate>Wed, 10 Mar 2010 11:34:05 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1896#comment-11328</guid>
		<description>@Vojtech,
Thank you!</description>
		<content:encoded><![CDATA[<p>@Vojtech,<br />
Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vojtech Kurka</title>
		<link>http://code.openark.org/blog/mysql/tip-faster-than-truncate/comment-page-1#comment-11327</link>
		<dc:creator>Vojtech Kurka</dc:creator>
		<pubDate>Wed, 10 Mar 2010 11:30:18 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1896#comment-11327</guid>
		<description>Morgan, large ibd files are not the only cause. Shlomi, It&#039;s a bug, just look at:  http://bugs.mysql.com/bug.php?id=35077 http://bugs.mysql.com/bug.php?id=51325 http://bugs.mysql.com/bug.php?id=51557</description>
		<content:encoded><![CDATA[<p>Morgan, large ibd files are not the only cause. Shlomi, It's a bug, just look at:  <a href="http://bugs.mysql.com/bug.php?id=35077" rel="nofollow">http://bugs.mysql.com/bug.php?id=35077</a> <a href="http://bugs.mysql.com/bug.php?id=51325" rel="nofollow">http://bugs.mysql.com/bug.php?id=51325</a> <a href="http://bugs.mysql.com/bug.php?id=51557" rel="nofollow">http://bugs.mysql.com/bug.php?id=51557</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morgan Tocker</title>
		<link>http://code.openark.org/blog/mysql/tip-faster-than-truncate/comment-page-1#comment-11315</link>
		<dc:creator>Morgan Tocker</dc:creator>
		<pubDate>Tue, 09 Mar 2010 23:23:15 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1896#comment-11315</guid>
		<description>shlomi: The table renamed &amp; dropped still has some contention issues (lock_open mutex will be held), but your trick is still useful for emptying a table and being able to use it again.</description>
		<content:encoded><![CDATA[<p>shlomi: The table renamed &amp; dropped still has some contention issues (lock_open mutex will be held), but your trick is still useful for emptying a table and being able to use it again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shlomi</title>
		<link>http://code.openark.org/blog/mysql/tip-faster-than-truncate/comment-page-1#comment-11312</link>
		<dc:creator>shlomi</dc:creator>
		<pubDate>Tue, 09 Mar 2010 14:44:01 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1896#comment-11312</guid>
		<description>@Darius,

Not a problem, since the dropped table has no contention: no one is writing to it.</description>
		<content:encoded><![CDATA[<p>@Darius,</p>
<p>Not a problem, since the dropped table has no contention: no one is writing to it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Darius Jahandarie</title>
		<link>http://code.openark.org/blog/mysql/tip-faster-than-truncate/comment-page-1#comment-11311</link>
		<dc:creator>Darius Jahandarie</dc:creator>
		<pubDate>Tue, 09 Mar 2010 14:02:39 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1896#comment-11311</guid>
		<description>Isn&#039;t the table being dropped after renamed though? It should still have the same contention on the disk (if that was the original problem), as long as you are deleting the data.</description>
		<content:encoded><![CDATA[<p>Isn't the table being dropped after renamed though? It should still have the same contention on the disk (if that was the original problem), as long as you are deleting the data.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shlomi</title>
		<link>http://code.openark.org/blog/mysql/tip-faster-than-truncate/comment-page-1#comment-11310</link>
		<dc:creator>shlomi</dc:creator>
		<pubDate>Tue, 09 Mar 2010 13:19:50 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1896#comment-11310</guid>
		<description>Hi Morgan,

So simple... :D, thanks!

At least on two machines I have xfs for sure, though... So there&#039;s still a small mystery...</description>
		<content:encoded><![CDATA[<p>Hi Morgan,</p>
<p>So simple... <img src='http://code.openark.org/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> , thanks!</p>
<p>At least on two machines I have xfs for sure, though... So there's still a small mystery...</p>
]]></content:encoded>
	</item>
</channel>
</rss>

