Does the SQL standard indicate the locking order for a query with multiple tables?
For example, given:
SELECT department.id FROM permissions, terminals, departments WHERE department.id = ? AND terminal.id = ? AND permissions.parent = department.id AND permissions.child = terminals.id;
- Is the SQL standard a guarantee of the locking order or is it determined by its execution plan?
- Is there a way to guarantee the lock order?
- If there is no way to guarantee the lock order, how should we prevent deadlocks?
UPDATE . Please do not vote to close this problem without explaining your reasoning. As far as I know, this is a programming issue that makes it very relevant for Stackoverflow. If you think that the question needs further clarification, explain, and I will be more than happy to answer you.
sql deadlock
Gili May 14 '13 at 20:09 2013-05-14 20:09
source share