-
Nisha Gopalakrishnan authored
Analysis: -------- OPTIMIZE TABLE on INNODB or PARTITIONED INNODB tables doesn't allow concurrent changes to the same table, thus causing down time in user applications. OPTIMIZE TABLE for INNODB or PARTITIONED INNODB tables uses ALTER TABLE FORCE operation internally to address the fragmentation problem. This operations involves a table copy and taking a strong lock on SQL-layer which blocks all concurrent changes to the table. The downtime is high while performing the operation for large tables. Fix: ---- MySQL supports online rebuilding of tables within the storage engine for INNODB or PARTITIONED INNODB tables starting from MySQL 5.6.4. With this patch, the operations listed below will trigger online rebuild of table. a) OPTIMIZE TABLE. b) ALTER TABLE FORCE and c) ALTER TABLE ENGINE= INNODB(Same engine during creation) The online rebuild involves taking strong lock only for brief interval of time thus reducing the downtime for the operations. Concurrent changes to the table are allowed and the time taken to complete the operation is reduced considerably. Note that these operations will continue to use table copy under any of the below conditions: a) 'old_alter_table' system variable is turned ON. b) 'skip-new' mysqld option is enabled and OPTIMIZE TABLE operation is performed. c) Algorithm COPY is explicitly specified for the ALTER TABLE operations.
Nisha Gopalakrishnan authoredAnalysis: -------- OPTIMIZE TABLE on INNODB or PARTITIONED INNODB tables doesn't allow concurrent changes to the same table, thus causing down time in user applications. OPTIMIZE TABLE for INNODB or PARTITIONED INNODB tables uses ALTER TABLE FORCE operation internally to address the fragmentation problem. This operations involves a table copy and taking a strong lock on SQL-layer which blocks all concurrent changes to the table. The downtime is high while performing the operation for large tables. Fix: ---- MySQL supports online rebuilding of tables within the storage engine for INNODB or PARTITIONED INNODB tables starting from MySQL 5.6.4. With this patch, the operations listed below will trigger online rebuild of table. a) OPTIMIZE TABLE. b) ALTER TABLE FORCE and c) ALTER TABLE ENGINE= INNODB(Same engine during creation) The online rebuild involves taking strong lock only for brief interval of time thus reducing the downtime for the operations. Concurrent changes to the table are allowed and the time taken to complete the operation is reduced considerably. Note that these operations will continue to use table copy under any of the below conditions: a) 'old_alter_table' system variable is turned ON. b) 'skip-new' mysqld option is enabled and OPTIMIZE TABLE operation is performed. c) Algorithm COPY is explicitly specified for the ALTER TABLE operations.
Loading