开发者

MYSQL InnoDB fast delete?

开发者 https://www.devze.com 2023-01-23 12:33 出处:网络
I have an InnoDB table that continually refreshes with a new set of data. So, I do a delete from table (everything) and then insert the new set of data.

I have an InnoDB table that continually refreshes with a new set of data.

So, I do a delete from table (everything) and then insert the new set of data.

However the table can never be Without a data set, so I do the above in a transaction.

Everything is wonderful functionally, but the deletes is getting dangerously slow.

Does anyone know of a non-DDL way of speeding up开发者_Python百科 deletes ?


I wonder if creating a second table "nextdataset" and then renaming it would work, I've never tried this. http://dev.mysql.com/doc/refman/5.0/en/rename-table.html


Can you say something more about the table? (for example contraints, foreign keys, etc.?)

Without any information I would suggest

TRUNCATE

Here's documentation: Mysql-Truncate


Use TRUNCATE TABLE (MySQL manual)


run the command \G SHOW INNODB STATUS in your mysql monitor when deleting or truncate process operation. MyIsam Table is much faster than InnoDB, but no rollBack is possible..

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号