Quick Column Adding Feature

Last updated: 2020-06-15 13:00:01

    This document describes how to use the instant algorithm to quickly add columns in big tables, while avoiding data replication. This feature does not replicate the data or use disk capacity/IO, and can implement changes in real time during peak hours.

    Limits

    • Instance version: MySQL 5.7 High-Availability Edition and Finance Edition
    • Kernel minor version: 20190830 and above

      Newly purchased instances use the latest kernel minor version by default. For more information on how to view the kernel minor version, see How do I check the Kernel minor version?. For more information on kernel updates, see Kernel Version Update.

    Instructions

    Log in to the database and use the following syntax to quickly add a column:

    ALTER TABLE t1 ADD COLUMN c1 int, algorithm=instant;
    • The innodb_alter_table_default_algorithm parameter is used to specify the default ALTER TABLE algorithm. If INSTANT is configured, there is no need to specify the algorithm=instant syntax for ALTER TABLE. Currently, you cannot directly modify the default value of this parameter. To modify it, please submit a ticket.
    • The innodb_alter_table_default_algorithm parameter can be configured as INPLACE (default value) or INSTANT.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help