Re: MYsql getting crash
Posted by:
Rick James
Date: October 30, 2009 10:16AM
Don't delete all at once. Delete in smallish chunks -- perhaps 100 to 1000 rows. If you have an AUTO_INCREMENT id on the table, the write a loop something like this:
$a = 0;
$maxid = SELECT MAX(id) FROM tbl;
WHILE ($a < $maxid)
DELETE FROM tbl WHERE id BETWEEN a AND a + 99 AND ...;
$a = $a + 100;
(optional) sleep 1 second;
If you don't have an auto_increment id, there are other tricks to play.
That will take awhile to run, but it won't lock the table for long enough to notice.
Subject
Written By
Posted
Re: MYsql getting crash
October 30, 2009 10:16AM
November 06, 2009 02:33AM
November 06, 2009 10:28AM
December 06, 2009 07:51AM
December 30, 2009 11:42PM
December 31, 2009 03:06AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.