K!

by Karl Bunyan

Programming, PHP, JavaScript, .Net, motorbikes, pubs, poker, football, news, restaurants and anything else

Facebook
http://twitter.com/karlbunyan

Wednesday, September 29, 2004

MySQL Truncate slow performance problems

I was having problems with a MySQL TRUNCATE taking a long time on a very large table (with foreign keys). I had thought that TRUNCATE ran more quickly than DELETE but, according to the MySQL manual, that isn't the case with InnoDB tables. In this case there is no difference between TRUNCATE and DELETE and it's recommended to drop the table and then re-create it. That sounds like a very high risk operation to me, but given that the TRUNCATE statement is taking an hour and a half to run then it looks like I've got some code to write. TRUNCATE in the MySQL documentation

Link to this post

Comments:

My solution to this can be found here.

posted by Blogger Karl Bunyan : August 18, 2005 11:47 AM

Post a Comment

Recent posts in the Programming category

Recent posts in the MySQL category

Archive

Other links

Change the background image