During altering table process MySql copy all data to tmp, to backup it. And only after it - altering, that part takes about few seconds. In case of big amount of data - table size ~300GB - this process could take us long period of time.
Is there any way to turn this “copy to tmp” option off?
MySQL isn’t ‘copying to tmp’ to backup the contents. The temporary table contents are the contents of the NEW table which is filled up with rows from the old table. At the end of the ALTER process, the temporary table is made permanent and swapped with the old table then the old table is dropped.
You can use pt-online-schema-change, part of Percona Toolkit to do online ALTER operations to large tables.
Thanks! It solved the problem.