meow
meow

Reputation: 28184

Truncating table does not make the mysql file smaller

I truncated several huge tables, but the mysql file and database appears to remain at the same size.

Does truncate table delete the data from mysql as well?

Upvotes: 6

Views: 8018

Answers (2)

Gopal
Gopal

Reputation: 11

In Version 5.1.55 size was not reduced after Truncate , even with innodb_file_per_table='ON'. So need to DROP and then CREATE the table and then Size was reduced.

Upvotes: 1

volody
volody

Reputation: 7199

When a large table is deleted or truncated InnoDB storage engine for MySQL will leave the empty space, and use it for subsequent insertion of new row versions.

There are ways to shrink database. Check Re: how to shrink a MySQL database

Upvotes: 6

Related Questions