Reply to comment

Shrinking InnoDB files

On one of my Typo3 installations I found an unusually large InnoDB file (Typo3's indexed_search being the culprit).

dev.mysql.com/doc/refman/5.1/en/adding-and-removing.html is a bit more complex. Instead of mysqldump (step 1 per documentation) I ran this SQL statement, following Nickolay Pelov's suggestion.

Here are the SQL statements I used to create the scripts to shrink this file:

use information_schema;

-- gather all innodb tables and make them myisam
select concat('alter table ', table_schema, '.', table_name, ' type=myisam;') from tables where engine='INNODB';

-- reset them to innodb
select concat('alter table ', table_schema, '.', table_name, ' type=innodb;') from tables where engine='INNODB';


Note that this fails if you have foreign keys on your InnoDB tables because MyISAM doesn't support them.

 

Reply

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • You may post PHP code. You should include <?php ?> tags.

More information about formatting options