View Single Post

   
  #3 (permalink)  
Old 02-28-2008, 06:06 AM
Brent Baisley
 
Posts: n/a
Default Re: a 'safe' way to move data?

No, you can't assure the same data will be addressed without at least including an order by. Even then you would need to make sure
that the first X records in the order would not change. For instance, if you order by entered_date DESC, then the data set would
change because any new records would get included in the LIMIT.


----- Original Message -----
From: "Ian P. Christian" <pookey@pookey.co.uk>
To: <mysql@lists.mysql.com>
Sent: Friday, March 30, 2007 8:18 AM
Subject: a 'safe' way to move data?


> I'm trying to move data between 2 tables.
>
> > INSERT INTO new_table SELECT * FROM old_table LIMIT 50000;
> > DELETE FROM old_table LIMIT 50000;

>
> This is the only process that deletes data from old_table, can I be *sure* that the limit in these 2 queries will address the same
> data set?
>
> (if I don't limit to small numbers in the LIMIT, I/O gets too high, so I'm moving data slowly in batches)
>
> 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=brenttech@gmail.com
>


Reply With Quote