Using Transactions In MySQL (Part 2) - Holding Pattern
(Page 7 of 10 )
Obviously, this means that other users are blocked from the table while the transaction is in progress and the lock is active. This is clearly illustrated in
the following snippet, which shows client B waiting until client A finishes with its tables and releases its locks.
This is the primary downside of using table locks to simulate a transactional environment with MyISAM tables; with long transactions, it can result in a significant speed reduction as different sessions "wait" for the session initiating the transaction to release its locks on various tables. Therefore, it's a good idea to always make sure that your transactions are small in size and execute quickly, else you'll have one very annoyed DBA after you!
This type of table locking is typically used in legacy MySQL environments where the new transactional formats are not supported; new users who need transactions will typically head straight for the InnoDB format, which eliminates both the problems above.
Next: Timberrrrrrrrrr! >>
More MySQL Articles
More By icarus, (c) Melonfire