2

I am using Percona MySQL 5.5.28 MySQl server on linux system with ext4 file system and 23 GB ram out of which 15 GB approx is allocated to MySQL.... I fired a query something like below

INSERT IGNORE INTO table_A SELECT field1,field2,....fieldn FROM table_B;

The above query is locking table_B.... Due to which alter query which i have fired later on the table_B locked.

Above two table are of Innodb and My entire db operations is only Innodb storage engine only.....

Can Anyone please tell me why MySQL locked table_B has locked here ?

If Possible Please let me know when and which queries will lock a table in MySQL ?

2

1 Answer 1

0

This is an old question, but in case someone stumbles on it like I did, the short answer is that adding SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; before the query sometimes works.

More info: How to improve INSERT INTO ... SELECT locking behavior

Note that the mentioned innodb_locks_unsafe_for_binlog approach was deprecated as of MySQL 5.6.3. (http://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_locks_unsafe_for_binlog).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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