In the past, some developers may have implemented a kind of "instant add column" in the application by encoding multiple columns in a single TEXT or BLOB column. ADD COLUMN operation is only slightly more expensive than a regular INSERT, due to locking constraints. For a large table, instead of taking several hours, the operation would be completed in the blink of an eye. ADD COLUMN, all that is needed is an O(log n) operation to insert a special hidden record into the table, and an update of the data dictionary. ![]() In contrast, with the new instant ALTER TABLE. When a column was added to a table with the older in-place optimization, the resulting table rebuild could still significantly increase the I/O and memory consumption and cause replication lag. See InnoDB Online DDL Overview for more information about online DDL with InnoDB.Īllowing concurrent DML during the operation does not solve all problems. These online DDL optimizations allow concurrent DML to the table in many cases, even if the table needs to be rebuilt. The InnoDB storage engine has implemented online DDL for many operations. In MariaDB 10.0 and later, the ALTER TABLE statement supports online DDL for storage engines that have implemented the relevant online DDL algorithms and locking strategies. ![]()
0 Comments
Leave a Reply. |