<?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: How to find out who is locking a table  in MySQL</title>
	<link>http://www.xaprb.com/blog/2006/07/31/how-to-analyze-innodb-mysql-locks/</link>
	<description>Stay curious!</description>
	<pubDate>Sat, 30 Aug 2008 04:11:44 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>

	<item>
		<title>By: Levi</title>
		<link>http://www.xaprb.com/blog/2006/07/31/how-to-analyze-innodb-mysql-locks/#comment-1397</link>
		<author>Levi</author>
		<pubDate>Tue, 08 Aug 2006 23:44:04 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/07/31/how-to-analyze-innodb-mysql-locks/#comment-1397</guid>
		<description>&lt;p&gt;SHOW PROCESSLIST; also helps a lot.&lt;/p&gt;

&lt;p&gt;In particular, it’s the only way I’ve found to identify MyISAM implicit locks: MyISAM doesn’t support transactions, and prioritises updates over reads. To avoid inconsistent data, reads can cause implicit table locks.&lt;/p&gt;

&lt;p&gt;Where this matters is a situation like the following:&lt;/p&gt;

&lt;pre&gt;SELECT * from bigTable WHERE (complicatedQueryConditions);
UPDATE bigTable SET someField=someField+1 WHERE id=1;&lt;/pre&gt;

&lt;p&gt;The SELECT will lock out the UPDATE until it finishes, and because updates are prioritised over reads and new selects will in turn be waiting for the UPDATE to finish.&lt;/p&gt;

&lt;p&gt;If the SELECT takes eg 30 seconds, in effect every access to that table will be waiting on the SELECT. In such a situation, SHOW PROCESSLIST will be able to show you which query is not in a LOCKED state, and you can identify the evil query quite quickly.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>SHOW PROCESSLIST; also helps a lot.</p>
<p>In particular, it’s the only way I’ve found to identify MyISAM implicit locks: MyISAM doesn’t support transactions, and prioritises updates over reads. To avoid inconsistent data, reads can cause implicit table locks.</p>
<p>Where this matters is a situation like the following:</p>
<pre>SELECT * from bigTable WHERE (complicatedQueryConditions);
UPDATE bigTable SET someField=someField+1 WHERE id=1;</pre>
<p>The SELECT will lock out the UPDATE until it finishes, and because updates are prioritised over reads and new selects will in turn be waiting for the UPDATE to finish.</p>
<p>If the SELECT takes eg 30 seconds, in effect every access to that table will be waiting on the SELECT. In such a situation, SHOW PROCESSLIST will be able to show you which query is not in a LOCKED state, and you can identify the evil query quite quickly.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
