Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.4
-
None
-
None
Description
InnoDB Online DDL Operations with the INSTANT Alter Algorithm reads:
With MariaDB 11.4 and later, InnoDB allows the addition of a primary key with ALGORITHM=INSTANT and LOCK=NONE. This operation takes place quickly and does not require the table to be rebuilt.
and
Starting with MariaDB 11.4, InnoDB supports dropping a primary key using ALGORITHM=INSTANT and LOCK=NONE. This operation executes quickly without requiring a table rebuild.
As a primary key is required to be unique and not nullable, and is used as a clustered index, it wouldn't be possible to ADD without validating and rebuilding.
ADD/DROP primary key are still listed on InnoDB Online DDL Operations with the INPLACE Alter Algorithm.
In the source code, they are listed as operations to rebuild in the ALTER handler.
And finally, testing the documentation example on 11.4.9 throws an error:
MariaDB [test]> CREATE TABLE tab ( |
-> a INT, |
-> b VARCHAR(50), |
-> c VARCHAR(50) |
-> );
|
Query OK, 0 rows affected (0.046 sec) |
 |
MariaDB [test]> ALTER TABLE tab ADD PRIMARY KEY (a), ALGORITHM=INSTANT, LOCK=NONE; |
ERROR 1845 (0A000): ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE |