List:General Discussion« Previous MessageNext Message »
From:Gerald L. Clark Date:June 4 2007 8:56pm
Subject:Re: Lock Tables Question
View as plain text  
David T. Ashley wrote:
> On 6/4/07, Jerry Schwartz <jschwartz@stripped> 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
Thread
Lock Tables QuestionDavid T. Ashley4 Jun
  • Re: Lock Tables QuestionGerald L. Clark4 Jun
    • Re: Lock Tables QuestionDavid T. Ashley4 Jun
      • RE: Lock Tables QuestionJerry Schwartz4 Jun
        • Re: Lock Tables QuestionDavid T. Ashley4 Jun
          • Re: Lock Tables QuestionGerald L. Clark4 Jun
            • Diff between restore from tar and recover from power outagemurthy gandikota4 Jun
              • Re: Diff between restore from tar and recover from power outageWm Mussatto4 Jun
                • Re: Diff between restore from tar and recover from power outageScott Tanner5 Jun
                  • Re: Diff between restore from tar and recover from power outagemos5 Jun
                    • Re: Diff between restore from tar and recover from power outageBaron Schwartz5 Jun
            • Re: Lock Tables QuestionDavid T. Ashley4 Jun
  • Re: Lock Tables QuestionBrent Baisley5 Jun
    • Re: Lock Tables QuestionDavid T. Ashley5 Jun
      • Re: Lock Tables QuestionBaron Schwartz5 Jun
        • Re: Lock Tables QuestionDavid T. Ashley5 Jun
          • Re: Lock Tables QuestionPaul McCullagh5 Jun