The challenge If you have a large MySQL table and you're trying to add a new column and index it, you may have ran into this error:
Creating index 'Name' required more than 'innodb_online_alter_log_max_size' bytes of modification log. Please try again.
So how can you address it?
The solution
By default, recent MySQL versions will execute the ALTER
statement with the INPLACE flag (unless it's eligible for INSTANT
alter, though that's not always the case). this means that the
database is using a temporary log (size of
innodb_online_alter_log_max_size) which is by default 128MB in
most recent versions, to keep track of DML changes happening
during the ALTER command. So if the database is executing an
UPDATE/INSERT/DELETE during the ALTER, it will keep track of
those changes in the temp file, and then after the ALTER is done,
it will apply those changes to the table as well.
So you have several options we can …