<?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: MySQL&#8217;s stored procedure language could be so much more Useful</title>
	<atom:link href="http://blog.wl0.org/2009/01/mysqls-stored-procedure-language-could-be-so-much-more-useful/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.wl0.org/2009/01/mysqls-stored-procedure-language-could-be-so-much-more-useful/</link>
	<description>Random thoughts on different topics</description>
	<lastBuildDate>Thu, 22 Jul 2010 06:31:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: sjmudd</title>
		<link>http://blog.wl0.org/2009/01/mysqls-stored-procedure-language-could-be-so-much-more-useful/comment-page-1/#comment-1070</link>
		<dc:creator>sjmudd</dc:creator>
		<pubDate>Mon, 16 Nov 2009 09:19:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.wl0.org/?p=48#comment-1070</guid>
		<description>Also there&#039;s a feature request here: http://bugs.mysql.com/48777</description>
		<content:encoded><![CDATA[<p>Also there&#8217;s a feature request here: <a href="http://bugs.mysql.com/48777" rel="nofollow">http://bugs.mysql.com/48777</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sjmudd</title>
		<link>http://blog.wl0.org/2009/01/mysqls-stored-procedure-language-could-be-so-much-more-useful/comment-page-1/#comment-1048</link>
		<dc:creator>sjmudd</dc:creator>
		<pubDate>Sat, 14 Nov 2009 17:54:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.wl0.org/?p=48#comment-1048</guid>
		<description>It seems there is a worklog item to do something about this. See: http://forge.mysql.com/worklog/task.php?id=3696. I am still surprised how few people react to topics like this. I can only guess that having not seen the advantages that they bring they are not aware of what they are missing.</description>
		<content:encoded><![CDATA[<p>It seems there is a worklog item to do something about this. See: <a href="http://forge.mysql.com/worklog/task.php?id=3696" rel="nofollow">http://forge.mysql.com/worklog/task.php?id=3696</a>. I am still surprised how few people react to topics like this. I can only guess that having not seen the advantages that they bring they are not aware of what they are missing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sjmudd</title>
		<link>http://blog.wl0.org/2009/01/mysqls-stored-procedure-language-could-be-so-much-more-useful/comment-page-1/#comment-11</link>
		<dc:creator>sjmudd</dc:creator>
		<pubDate>Wed, 28 Jan 2009 23:17:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.wl0.org/?p=48#comment-11</guid>
		<description>I only wrote this yesterday, and today we had a problem. One of our very busy database servers normally has a cleanup script which run every minute and removes old data. That&#039;s been working fine for a long long time. Somehow the script had been turned off. When we realised we turned it back on again. This started causing some problems.

Why? The cleanup script wasn&#039;t expected to take long. It was designed to delete old data. However there was a lot more data to delete so it took longer. As it took longer it also affected the other active connections which were accessing the same table, and caused some disruption.

The simple script:

&lt;blockquote&gt;DELETE FROM table_name WHERE &lt;old_condition&gt; LIMIT &lt;limit&gt;&lt;/blockquote&gt;

was designed to delete small blocks. MySQL however was scanning too much of the index thus causing contention.

So now we have to adjust the script to:
- have a few delays between runs
- to find a better &quot;condition clause&quot; designed to make the index scan faster, and the LIMIT clause if not unnecessary at least less likely to be triggered.

This is a typical example of what to do in a stored procedure, or perhaps what to do from the command line as a block of mysql code.

As it is our solution is likely to do the same thing but to run as a script from cron using perl (DBI).  Nothing wrong with perl but this is just not needed. It should be doable from the command line.</description>
		<content:encoded><![CDATA[<p>I only wrote this yesterday, and today we had a problem. One of our very busy database servers normally has a cleanup script which run every minute and removes old data. That&#8217;s been working fine for a long long time. Somehow the script had been turned off. When we realised we turned it back on again. This started causing some problems.</p>
<p>Why? The cleanup script wasn&#8217;t expected to take long. It was designed to delete old data. However there was a lot more data to delete so it took longer. As it took longer it also affected the other active connections which were accessing the same table, and caused some disruption.</p>
<p>The simple script:</p>
<blockquote><p>DELETE FROM table_name WHERE &lt;old_condition&gt; LIMIT &lt;limit&gt;</p></blockquote>
<p>was designed to delete small blocks. MySQL however was scanning too much of the index thus causing contention.</p>
<p>So now we have to adjust the script to:<br />
- have a few delays between runs<br />
- to find a better &#8220;condition clause&#8221; designed to make the index scan faster, and the LIMIT clause if not unnecessary at least less likely to be triggered.</p>
<p>This is a typical example of what to do in a stored procedure, or perhaps what to do from the command line as a block of mysql code.</p>
<p>As it is our solution is likely to do the same thing but to run as a script from cron using perl (DBI).  Nothing wrong with perl but this is just not needed. It should be doable from the command line.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
