In mySQL 5.6, what is the default behavior of the ALGORITHM parameter?

I am using MySQL 5.6 (and its Online-DDL feature) to generate some in-place table operations like "ADD COLUMN". I see that the LOCK parameter defaults to the highest level of concurrency allowed (for ADD COLUMN it should be "NONE"), but what is the default behavior for the ALGORITHM parameter? The documentation says, "ALGORITHM = DEFAULT is the same as without the ALGORITHM clause." but this is not useful because it does not say that ALGORITHM = DEFAULT is equal.

http://dev.mysql.com/doc/refman/5.6/en/alter-table.html

Somebody knows?

+3


source to share


1 answer


The default depends on which change you are trying to apply.

Some changes may use ALGORITHM = INPLACE, so this is their default. Other changes can never use online DDL, so their default is ALGORITHM = COPY. For example, changing the data type or dropping the primary key is not possible in place.



See https://dev.mysql.com/doc/refman/5.6/en/innodb-create-index-overview.html . They document how different operations are handled, and the ones that say "No" in the "Inplace" column use ALGORITHM = COPY by default and don't work if you try to use ALGORITHM = INPLACE.

You can force an operation to use ALGORITHM = COPY even if it can do its job in-place, but you cannot request an operation to use ALGORITHM = INPLACE if it cannot.

+5


source







All Articles