Tag Info

New answers tagged


DELETE FROM t Does not cause an implicit commit and should work well. I'm actually using this exact solution in production and see no issue transaction-wise (of course deleting all rows from a large table has a significant impact on the size of the transaction, followed possibly by increased IO, increased size of binary logs etc.)


Since TRUNCATE TABLE does an implicit commit, don't use it. As long as the table does not have foreign keys, you can do it quickly like this: CREATE TABLE mytable_new LIKE mytable; RENAME TABLE mytable TO mytable_old,mytable_new TO mytable; INSERT INTO mytable ... ; If the INSERT succeeds, then run this DROP TABLE mytable_old; If the INSERT rolls ...

Top 50 recent answers are included