List:General Discussion« Previous MessageNext Message »
From:Issac Goldstand Date:June 7 2004 11:18am
Subject:Multiple locks
View as plain text  
I need to do some operations which insert mass amounts of records which then
must be sorted, and would like to use table locking.

The flow I'm looking for is:
LOCK TABLE A WRITE LOW_PRIO
DELETE FROM TABLE A (This used to be TRUNCATE TABLE A, but that complained
when I started locking)
LOAD DATA INFILE ... REPLACE INTO TABLE A
LOCK TABLE B WRITE
*while* SELECT FROM TABLE A
*process data and then* REPLACE INTO TABLE B
DELETE FROM TABLE A (Also, used to be truncate)
UNLOCK TABLES

I don't seem to be able to lock a and then b later.
I don't want to lock B from the start, because the LOAD DATA might take a
while.
I don't want to unlock and relock A, because other scripts may modify the
data...

Any suggestions, pointers, RTFMs? (I looked at 14.4.5 and links from there
already)
Thanks!
  Issac

Thread
Multiple locksIssac Goldstand7 Jun