Truncating large tables, with millions of rows, in InnoDB can be very tedious. Fortunately, there is a little trick to speed up the process. This trick only makes sense with databases over 1GB. The trick is to first create a table with the same structure as the table we are shrinking.
Note: Watch out for foreign keys here.
CREATE TABLE new_tableLIKEbig_table;
Then we replace the old table with the new one.
RENAME TABLE big_tableTOold_table, new_tableTObig_table;
After this step, the system will use the new (empty) table, and now we can quickly delete the old table.
DROP TABLE old_table;
Done.