Search code examples
mysqlinnodbdiskspace

How to reclaim disk space in InnoDB after dropping table


I have a big InnoDB table in mysql. The problem is my disk space is almost full. I want to reduce my disk space. If I'll delete some rows from the table and use this command:

optimize TABLE_NAME

then my disk space will be reduced. But I want to drop the table. If I'll drop the table, there is not any table to optimize it! What is the appropriate command to reduce disk space after dropping the InnoDB table?


Solution

  • drop command will free disk space automatically.

    Note: Assuming you are using innodb_file_per_table as you are able to free space by optimize table syntax.