What happens if I restart a MariaDB server while it is Repairing or Optimizing a very large table (like at least 20GB)? Probably because I need to use the table for other stuff and I'm just getting plain bored.
REPAIR
and OPTIMIZE
are designed to be crash-safe. (Or at least to a large extent.)
OPTIMIZE
, for example, copies the table over to a tmp table name. When finished, it internally does a RENAME TABLE
, which is fast.
OPTIMIZE
is needed in only very rare cases for MyISAM. It is even less needed for InnoDB. What is your use case? I will probably counter that it is 'futile' or 'not worth the effort'.
Repair is needed only for MyISAM. I hope you are not using that antiquated engine.
More
REPAIR
is much less often needed, plus is automated.ANALYZE TABLE
(instead) when there is no complaint about index corruption yet queries are suddenly slow.