David T. Ashley wrote:
On 6/4/07, Jerry Schwartz <[EMAIL PROTECTED]> wrote:


Whatever you do, make sure that every bit of code that locks multiple
resources locks them in the same order. That's the only way to avoid
deadlocks.



Hi Jerry,

I really appreciate the good advice.

However, my original question is still unanswered.  My original question is
whether I can lock one table (as a gentleman's rule followed by all
processes) to serialize access to the database consisting of many tables.

LOCK TABLE x;
Manipulate many tables, perhaps not even including table x;
UNLOCK TABLES;

My question is really whether MySQL might do some strange optimizations ...
or somehow buffer the middle query so that it completes after the UNLOCK.

Thanks, Dave.

Once you issue a LOCK TABLES command, you may not access any tables not in the LOCK statement. You must lock *ALL* tables you will use, perform
your updates, and then UNLOCK TABLES.

--
Gerald L. Clark
Supplier Systems Corporation

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to