Is restoring a mysql database backup faster at removing white space than running OPTIMIZE? 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 &lt;TABLE NAME&gt;; 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 &gt; /tno/FooBackup.sql

2) Then run: mysql -u root -vvv &lt; /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?
Both will achieve essentially the same thing. If your exact db version doesn't offer online OPTIMIZE then the dump and restore could be useful if you restore into a new table and then DROP the old one and RENAME the new one, allowing concurrent selects during the import. Regarding the speed, the dump and restore might be a bit faster but it's probably not a huge gain. I prefer it if I'm working with a version that doesn't support online OPTIMIZE. 

As Rick James mentioned this sort of thing isn't often necessary, but I have seen it help to bulk re-balance indices on tables with columns struggling to keep up with a large number of concurrent updates.