Do MySQL Locked Tables affect related Views?

Posted by CogitoErgoSum on Stack Overflow See other posts from Stack Overflow or by CogitoErgoSum
Published on 2010-06-09T18:31:43Z Indexed on 2010/06/09 18:42 UTC
Read the original article Hit count: 200

Filed under:
|
|

So after reading http://stackoverflow.com/questions/1415602/performance-in-pdo-php-mysql-transaction-versus-direct-execution in regards to performance issues I was thinking about I did some research on locking tables in MySQL.

On http://dev.mysql.com/doc/refman/5.0/en/table-locking.html

Table locking enables many sessions to read from a table at the same time, but if a session wants to write to a table, it must first get exclusive access. During the update, all other sessions that want to access this particular table must wait until the update is done.

This part struck me particularly becuase most of our queries will be updates rather than inserts. I was wondering if one created a table called foo on which all updates/inserts were carried out and then a view called foo_view (A copy of foo, or perhaps foo and a linkage of several other tables plus foo) on which all selects occured, would this locking issue still occur?

That is, would SELECT quries on foo_view still have to wait for an update to finish on foo?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about views