Mysql concurrency: what happens if access to a locked table?

The question is quite simple, but I did not find the exact answer: In myisam db, what happens if the php file locks the table (with an atomic operation, say, INSERT), and another php file tries to access the same table (read or write )?

Now, although it is obvious that the second session will not be able to access the table, what exactly is happening? Does any error return? Does she wait in line until she can access her?

+7
source share
1 answer

The second connection will wait for the lock to be released.

In MyISAM, any record (insert / update / delete) will lock the table,

However, with an INNODB table type, an atom operation will only block affected rows.

+6
source

All Articles