Documentation Home
MySQL 5.6 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 31.5Mb
PDF (A4) - 31.5Mb
PDF (RPM) - 30.6Mb
HTML Download (TGZ) - 7.6Mb
HTML Download (Zip) - 7.7Mb
HTML Download (RPM) - 6.6Mb
Man Pages (TGZ) - 187.5Kb
Man Pages (Zip) - 302.1Kb
Info (Gzip) - 2.9Mb
Info (Zip) - 2.9Mb
Excerpts from this Manual

MySQL 5.6 Reference Manual  /  ...  /  Online DDL for Partitioned Tables

14.13.7 Online DDL for Partitioned Tables

With the exception of ALTER TABLE partitioning clauses, online DDL operations for partitioned InnoDB tables follow the same rules that apply to regular InnoDB tables. Online DDL rules are outlined in Table 14.8, “Online Status for DDL Operations”.

ALTER TABLE partitioning clauses do not go through the same internal online DDL API as regular non-partitioned InnoDB tables, and most do not support ALGORITHM and LOCK clauses.

If you use an ALTER TABLE partitioning clause in an ALTER TABLE statement, the partitioned table is repartitioned using the ALTER TABLE COPY algorithm. In other words, a new partitioned table is created with the new partitioning scheme. The newly created table includes any changes applied by the ALTER TABLE statement and the table data is copied into the new table structure.

If you do not modify table partitioning using ALTER TABLE partitioning clauses that use the COPY algorithm or perform any other partition management in your ALTER TABLE statement, ALTER TABLE performs supported INPLACE operations on each table partition. Be aware, however, that when INPLACE ALTER TABLE operations are performed on each partition, there is increased demand on system resources due to operations being performed on multiple partitions.

Even though partitioning clauses of the ALTER TABLE statement do not go through the same internal online DDL API as regular non-partitioned InnoDB tables, MySQL still attempts to minimize data copying and locking where possible:

  • ADD PARTITION and DROP PARTITION for tables partitioned by RANGE or LIST do not copy any existing data.

  • TRUNCATE PARTITION does not copy existing data.

  • Concurrent queries are allowed during ADD PARTITION and COALESCE PARTITION for tables partitioned by HASH or LIST. MySQL copies the data while holding a shared lock.

  • For REORGANIZE PARTITION, REBUILD PARTITION, or ADD PARTITION or COALESCE PARTITION for a table partitioned by LINEAR HASH or LIST, concurrent queries are allowed. Data from the affected partitions is copied while holding a shared metadata (read) lock at the table level.

  • PARTITION BY and REMOVE PARTITIONING support the ALGORITHM clause with the DEFAULT or COPY option. Both operations permit concurrent queries.

For additional information about ALTER TABLE partitioning clauses, see Partitioning Options, and Section 13.1.7.1, “ALTER TABLE Partition Operations”. For information about partitioning in general, see Chapter 19, Partitioning.


User Comments
Sign Up Login You must be logged in to post a comment.