I have a myisam database running on MariaDB 10.x. I'm pretty sure it has a lot of whitespace that I'd like to trim down. I was planning to run OPTIMIZE <TABLE NAME>;
but a thought occurred to me: would it be faster/easier to just collect a backup and restore it?
For example...
1) Run: mysqldump -u root --hex-blob --add-drop-database --databases FooDatabase > /tno/FooBackup.sql
2) Then run: mysql -u root -vvv < /tmp/FooBackup.sql
The white space wouldn't be in the backup file so presumably it would be compact upon restoring... and that way, MariaDB wouldn't need to go row by row checking for stuff.
Is that a bad idea? Admittedly, the backup/restore wouldn't check for errors or do the other things that optimize
does but if I'm ONLY interested in eliminating white space, wouldn't it be faster?
OPTIMIZE
. That command is rarely needed, even for MyISAM.SHOW TABLE STATUS
-- if Data_free is less than 10% of the total, don't bother doingOPTIMIZE
.