All Products
Search
Document Center

PolarDB:Instant column addition at the end of a table

Last Updated:Mar 28, 2026

Add a column to a table of any size in seconds, regardless of table size.

PolarDB for MySQL uses the INSTANT algorithm for this DDL operation. It modifies only metadata in the data dictionary — no historical data is modified or copied, and the table is never rebuilt.

Supported versions

VersionMinimum revisionNotes
PolarDB for MySQL 8.0AnyEnabled by default. No configuration required.
PolarDB for MySQL 5.75.7.1.0.6Enable the loose_innodb_support_instant_add_column parameter before use.
PolarDB for MySQL 5.65.6.1.0.43In canary release. Request access via the Quota Center using quota polardb_mysql_iac_56.

To check your cluster's revision number, see checking the version number.

Limitations

LimitationDetails
Column positionThe new column must be the last column in the table.
Virtual columnsSupported on 8.0. Not supported on 5.6 or 5.7.
Partitioned tablesNot supported on 5.6. Supported on 5.7 and 8.0. On 5.7, this is in canary release — request access via the Quota Center using quota polarM_57_iac_on_partition_table.
Full-text indexesTables with full-text indexes are not supported.
Compressed tablesTables with ROW_FORMAT=COMPRESSED are not supported.
Tables with In-Memory Column Indexes (IMCI)On 8.0.1.1.42 and earlier, or 8.0.2.2.23 and earlier: set imci_enable_add_column_instant_ddl to ON. When enabled, instant column addition triggers a silent background rebuild of the IMCI. The IMCI is unavailable during rebuilding. On 8.0.1.1.42 and later, or 8.0.2.2.23 and later: set imci_enable_add_column_instant_ddl to OFF.
Tables with implicit primary keysTables with implicit_primary_key enabled require a custom primary key.
Combined DDL statementsInstant column addition cannot be combined with other DDL operations (such as adding an index) in the same ALTER TABLE statement.

Prerequisites

Before you begin, ensure that you have:

  • A PolarDB for MySQL cluster running a supported version

  • For PolarDB for MySQL 5.6: quota access via the Quota Center

  • For PolarDB for MySQL 5.7: the loose_innodb_support_instant_add_column parameter set to ON

Enable instant column addition (5.6 and 5.7 only)

PolarDB for MySQL 8.0 clusters support instant column addition by default. For 5.6 and 5.7 clusters, enable the following parameter:

ParameterLevelDescription
loose_innodb_support_instant_add_columnGlobalEnables or disables instant column addition. Valid values: ON (enabled) and OFF (default, disabled).

For instructions on setting parameters, see Enable a parameter.

Add a column instantly

Force the INSTANT algorithm

Specify ALGORITHM=INSTANT to ensure the operation uses the INSTANT algorithm:

ALTER TABLE <table_name> ADD COLUMN <column_name> int, ALGORITHM=INSTANT;

If the cluster or table does not support instant column addition, the statement returns:

ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=COPY/INPLACE.

If you see this error, check that loose_innodb_support_instant_add_column is enabled and review the Limitations.

Let PolarDB select the algorithm automatically

Omit the ALGORITHM clause or specify ALGORITHM=DEFAULT to let PolarDB select the fastest available algorithm. PolarDB evaluates algorithms in this order: INSTANT > INPLACE > COPY.

ALTER TABLE <table_name> ADD COLUMN <column_name> int, ALGORITHM=DEFAULT;
ALTER TABLE <table_name> ADD COLUMN <column_name> int;

Verify that the INSTANT algorithm was used

PolarDB for MySQL 5.6 and 5.7

Query the INNODB_SYS_INSTANT_COLUMNS table in INFORMATION_SCHEMA. This table stores column names, ordinal positions, and default values (in binary format) for columns added using the INSTANT algorithm:

SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INSTANT_COLUMNS;
Note

If you later run a DDL operation that triggers a table rebuild (such as OPTIMIZE TABLE), PolarDB physically rebuilds the table. The INSTANT columns are converted to regular columns and their data is fully retained. The corresponding records are removed from INNODB_SYS_INSTANT_COLUMNS.

PolarDB for MySQL 8.0

Query INFORMATION_SCHEMA.INNODB_COLUMNS and check the has_default column. A value of 1 indicates the column was added using the INSTANT algorithm:

SELECT * FROM INFORMATION_SCHEMA.INNODB_COLUMNS
WHERE TABLE_ID = (
  SELECT TABLE_ID FROM INFORMATION_SCHEMA.INNODB_TABLES
  WHERE NAME = "<database_name>/<table_name>"
);

What's next

Contact us

If you have any questions about DDL operations, please contact technical support.