I am using truncate table table_name; on a table with around 1 million rows, but it's been taking too long, running since last 3 hours.
Is it normal? Can you suggest some other way to delete all rows from a table, which could be faster?
Truncate wont work in some cases such as ,
when you have index kind of things and some foreign key constraints
Easy way i suggest is
RENAME TABLE table_name TO t1;
CREATE TABLE table_name LIKE t1;
DROP TABLE t1;
or you can also use DELETE FROM table_name;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With