Hacking with PHP is being updated for PHP 7: pre-order for only $10! >>

Be wary of locks

When MySQL updates a table, it performs what is called a "lock" - it ensures that no other program can read or write from the table while it updates. As soon as MySQL has finished writing, it allows access again. So, it is best not to try to perform complicated SELECT statements (reads) on tables which are updated regularly, because your SELECT statement will stall.


If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!

Next chapter: Consider switching OS >>

Previous chapter: Consider splitting off variable-length fields

Jump to:


Home: Table of Contents

Copyright ©2015 Paul Hudson. Follow me: @twostraws.