Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have server running mysql and when I do a 'show processlist' at a mysql command prompt, I see a lot of INSERT and UPDATE queries from one particular user with a state of "locked" and very high times--some as high as 700 seconds. Could someone help me to understand what is going on here?

share|improve this question

1 Answer 1

Something tells me you are using a bunch of MyISAM tables.

Keep in mind the MyISAM tables perform table-level locks when doing any DML (INSERTs, UPDATEs, DELETEs). Such statements block other like statements. Even SELECTs can block DML.

If you convert all the MyISAM tables to InnoDB, this problem should disappear because InnoDB does row-level locking thus allowing rows to be added, deleted, updated and selected without lock contention.

CAVEAT: If any of the MyISAM table have FULLTEXT indexes, such tables cannot be converted to InnoDB. For all other tables, please convert them to InnoDB ASAP !!!

share|improve this answer
    
+1: Certainly innodb would resolve the problem of blocking for lots of small updates/inserts - but its not always the right solution. It depends on everything else which is going on with the system. Maybe the right apporach would be to look at the query which is blocking the update for 700 seconds –  symcbean Apr 7 '11 at 9:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.