Online DDL and Related Operations
During traditional DDL operations, tables cannot provide read and write services. As a result, services may be interrupted for a long time. Online DDL operations have little impact on running services, improving service continuity and database availability.
By using the ONLINE keyword, you can perform the following online DDL operations: Change column types and precisions, reduce lengths, increase the CHAR type lengths, move tablespaces at the table level, add NOT NULL, CHECK, PRIMARY KEY, and UNIQUE constraints, and perform VACUUM FULL. An exclusive lock is temporarily added to online DDL operations only in the early and later phases of the execution and does not block concurrent read and write services for a long time. For details, see ALTER TABLE and VACUUM.
Table 1 lists the supported online DDL operations.
Category |
Operation |
Required Time |
Remarks |
---|---|---|---|
Column operations |
The supported operations are as follows:
|
|
To change column types or precisions, reduce lengths, or increase CHAR type lengths, you need to use the ONLINE keyword. |
Table operations |
The supported operations are as follows:
|
|
To move tablespaces online at the table level, you need to use the ONLINE keyword. |
Tablespace operations |
The supported operations are as follows:
|
When only metadata is changed, the time required is irrelevant to the data volume. |
- |
Constraint operations |
The supported operations are as follows:
|
|
To add NOT NULL, CHECK, UNIQUE, and PRIMARY KEY constraints, you need to use the ONLINE keyword. |
Partition operations |
Add, delete, and truncate partitions, enable or disable row movement, and invalidate partitioned indexes. |
When only metadata is changed, the time required is irrelevant to the data volume. |
- |
Recycling storage space |
VACUUM FULL |
When data needs to be reorganized, the time required depends on the data volume. |
To recycle storage space, you need to use the ONLINE keyword. |
Index operations |
Build and rebuild the CONCURRENTLY index. |
When data needs to be queried, the time required depends on the data volume. |
For details about index operations, see CREATE INDEX and REINDEX. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot