[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: a 'safe' way to move data?
From:       "Ian P. Christian" <pookey () pookey ! co ! uk>
Date:       2007-03-30 14:48:15
Message-ID: 460D232F.6080900 () pookey ! co ! uk
[Download RAW message or body]

Dan Nelson wrote:
 > To be completely safe, you would want to use innodb tables, then select
 > only the primary key of the 50,000 records you're interested in, using
 > the "FOR UPDATE" keyword (to keep others from modifying those records
 > while you're doing the move).  Then "INSERT INTO newtable SELECT * FROM
 > oldtable WHERE primarykey in ( your 50,000 keys )", then "DELETE FROM
 > oldtable WHERE primarykey in ( your 50,000 keys )", then COMMIT, which
 > will cause your insertions and deletions to be truly atomic.

Ah of course - a far better idea.

Thanks :)

-- 
Ian P. Christian ~ http://pookey.co.uk

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=mysql-marcsub@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic