This topic describes how to defragment spaces in the databases for which the Open (DMS OnlineDDL first) feature is enabled in Data Management (DMS).

Prerequisites

Background information

Frequent execution of UPDATE and DELETE statements in a database results in space fragments. These space fragments may be wasted if they are not recycled. You can recycle space fragments to improve database performance.

Usage notes

  • If you do not need to change table schemas in the short run, you can submit a data change ticket to recycle space fragments.
  • If you need to change table schemas in the short run, you can submit a data change ticket to change schemas and recycle space fragments at the same time. This reduces workload.
Note Data change and space defragmentation can be implemented at the same time only for the databases for which the Open (DMS OnlineDDL first) feature is enabled.

Procedure

  1. Log on to the DMS console V5.0.
    Note To switch to the previous version of the DMS console, click the 5租户头像 icon in the lower-right corner of the page. For more information, see Switch to the previous version of the DMS console.
  2. On the Data Change Ticket Application page, set the parameters as required and enter the SQL statements that are used to modify the comments on tables or fields in the SQL Text field. After the data change, the table space is defragmented. For more information, see Change regular data.

    You can use one of the following SQL statements in the ticket:

    • ALTER TABLE table_name COMMENT 'Modified table comments';
    • ALTER TABLE table_name ENGINE=InnoDB;
    • OPTIMIZE TABLE table_name;
    • ALTER TABLE table_name MODIFY COLUMN field_name INT COMMENT 'Modified field comments';
Note Database administrators (DBAs) and DMS administrators can also change table schemas by running SQL tasks. For more information, see Task management.