Sample Header Ad - 728x90

What can cause TRUNCATE TABLE to take a really long time?

9 votes
2 answers
35692 views
I'm running MySQL5.5 with Master/Slave replication (1 master, 2 slaves). I have a process that runs once a week and truncate a specific table. The table is not large and only has a few thousands records. For some reason, the TRUNCATE TABLE command takes really long time to execute (both on the master and on the slave). It takes about 400K ms to execute!! When it runs on the slave, it causes it to lag from the Master. After the TRUNCATE TABLE finishes, everything is back to normal. I know that one of the slaves didn't receive any reads while performing the TRUNCATE TABLE since its a dedicated slave and the process that reads from that slave was down. Also, on this slave, it took the same amount of time to execute. Here is the table structure: http://pastebin.com/qEQB4juR Any thoughts on how I can speed up the TRUNCATE TABLE ?
Asked by Ran (1573 rep)
Jul 9, 2012, 08:42 PM
Last activity: Jun 23, 2022, 04:50 AM