| 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 Question | David T. Ashley | 4 Jun |
| • Re: Lock Tables Question | Gerald L. Clark | 4 Jun |
| • Re: Lock Tables Question | David T. Ashley | 4 Jun |
| • RE: Lock Tables Question | Jerry Schwartz | 4 Jun |
| • Re: Lock Tables Question | David T. Ashley | 4 Jun |
| • Re: Lock Tables Question | Gerald L. Clark | 4 Jun |
| • Diff between restore from tar and recover from power outage | murthy gandikota | 4 Jun |
| • Re: Diff between restore from tar and recover from power outage | Wm Mussatto | 4 Jun |
| • Re: Diff between restore from tar and recover from power outage | Scott Tanner | 5 Jun |
| • Re: Diff between restore from tar and recover from power outage | mos | 5 Jun |
| • Re: Diff between restore from tar and recover from power outage | Baron Schwartz | 5 Jun |
| • Re: Lock Tables Question | David T. Ashley | 4 Jun |
| • Re: Lock Tables Question | Brent Baisley | 5 Jun |
| • Re: Lock Tables Question | David T. Ashley | 5 Jun |
| • Re: Lock Tables Question | Baron Schwartz | 5 Jun |
| • Re: Lock Tables Question | David T. Ashley | 5 Jun |
| • Re: Lock Tables Question | Paul McCullagh | 5 Jun |
