Question

I have a table called path. It takes up about 99% of a 13G ibdata1. It was previously an INNODB table, but I converted it to MYISAM.

If I run optimize table on the new path table, will it free up my ibdata1 file? Or does this never reduce in size and I need to delete it and re-import a fresh database?

Was it helpful?

Solution

No. Dropping the InnoDB table will free up space within the InnoDB tablespace (ibdata1 file), but it will not shrink the ibdata1 file.

The exception is that if the table was created while the server innodb_file_per_table variable was set, then the table will be in its own separate InnoDB tablespace (datafile), and when the table is dropped, the space used by the table will be released.

See: 14.3.3. Using Per-Table Tablespaces http://dev.mysql.com/doc/refman/5.5/en/innodb-multiple-tablespaces.html

OTHER TIPS

The answer is no (better explanation above). What I had to do was this:

1) Dump the database
2) Stop mysql
3) Delete the `ibdata1` file and two log files.
4) Restart mysql
5) Import the sql dump.

This will get you back to the default ibdata1 file size. Then you can either 1) change the engine of the table to myisam if there are no integrity constraints on the table (which is what I did) or 2) set innodb_file_per_table=ON, if keeping the innodb table.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top