Mysql – With MySQL, how long does an “ALTER TABLE … DISABLE KEYS;” statement last

databasedatabase-administrationindexingMySQL

If you disable the keys (suspending indexing) on a mysql INNODB table, how long does that setting last?

For a query like:

ALTER TABLE users DISABLE KEYS;

Do the keys get re-enabled at the end of the script? or do they last until you explicitly turn indexing back on?

Best Answer

The Fine Manual (which is well worth Reading) suggests that the effect of that statement lasts until a corresponding ALTER TABLE ... ENABLE KEYS statement is executed.