Deadlock vs Lockwait Timeout on MySQL -


can explain me on details difference of deadlock , lockwait errors found on mysql 5.1. same? when deadlock error occur , when lockwait timeout occur?

a deadlock occurs circular dependency exists amongst locks transactions must acquire in order proceed: example, imagine transaction 1 holds lock needs acquire lock b proceed; , transaction 2 holds lock b needs acquire lock proceed—the transactions immediately deadlocked (no timeout required) , neither can proceed until 1 releases locks. solution 1 transaction rolled (one's application code should detect eventuality , handle accordingly, attempting transaction again).

a wait timeout occurs when configured timeout period (e.g. innodb_lock_wait_timeout in case of innodb locks) elapses whilst transaction awaits lock, perhaps because slow query holding lock , has not finished executing. it's possible (even, likely) lock have become available , been acquired if transaction had waited longer, timeout exists avoid applications waiting on database indefinitely.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -