Online and offline DDL operations

2026-02-11 07:43:39  Updated

The following table describes the online DDL operations supported by OceanBase Database V4.x in Oracle mode.

Type Operation Time spent Remarks
Index operation Add an index Related to the data volume, because data is reorganized (or rewritten) This operation mainly involves global indexes, local indexes, global indexes with specified partitions, and spatial indexes (supported in OceanBase Database V4.1.0 and later).
Index operation Drop an index Related to whether active transactions exist N/A
Index operation Rename an index Only for metadata modification N/A
Index operation Hybrid index operations Related to the operation with the longest execution time For example, ALTER TABLE t1 ADD INDEX i4(c1), DROP INDEX i2, RENAME INDEX i1 TO i1x involves hybrid index operations.
Column operation Add a column to the end of a table Only for metadata modification For example, add a LOB (TEXT) column by executing a statement such as ALTER TABLE tbl1 ADD c3 LOB.
Column operation Add a virtual column Only for metadata modification N/A
Column operation Drop a virtual column Only for metadata modification N/A
Column operation Drop a column No data reorganization N/A
Column operation Set a NOT NULL constraint on a column Related to the data volume, because data is queried N/A
Column operation Set a NULL constraint on a column Only for metadata modification N/A
Column operation Set a default value for a column Only for metadata modification N/A
Column operation Drop the default value of a column Only for metadata modification N/A
Column operation Change the value of an auto-increment column Only for metadata modification N/A
Column operation Rename a column Only for metadata modification N/A
Column operation Increase the length or precision of the data type for a column Only for metadata modification For example, increase the length of the INT type, increase the length of the VARCHAR type, or convert the NUMBER type.
Column operation Hybrid column operations Related to the operation with the longest execution time If an offline column operation is involved, the operation is upgraded to an offline DDL operation.
FOREIGN KEY constraint operation Add a FOREIGN KEY, CHECK, or NOT NULL constraint Related to the data volume, because data is queried N/A
FOREIGN KEY constraint operation Drop a FOREIGN KEY, CHECK, or NOT NULL constraint Related to the data volume, because data is queried N/A
Table operation Rename a table Only for metadata modification N/A
Table operation Change the row format Only for metadata modification N/A
Table operation Change the block size Only for metadata modification N/A
Table operation Change the compression algorithm Only for metadata modification N/A
Table operation Optimize a tablespace Only for metadata modification N/A

| Partition operation | Add a partition | Only for metadata modification | N/A |

The following table describes the offline DDL operations supported by OceanBase Database V4.x in Oracle mode. | Type | Operation | Time spent | Remarks | |-------------|--------------------------|--------------------------|--------------------| | Column operation | Add an auto-increment column | Related to the data volume, because data is reorganized (or rewritten) | N/A | | Column operation | Set a column as the primary key | Related to the data volume, because data is reorganized (or rewritten) | N/A | | Column operation | Add or drop a STORED generated column | Related to the data volume, because data is reorganized (or rewritten) | N/A | | Column operation | Clear a deprecated column | Related to the data volume, because data is reorganized (or rewritten) | N/A | | Column operation | Hybrid column operations | Related to the data volume, because data is reorganized (or rewritten) | N/A | | Primary key operation | Add or drop a primary key | Related to the data volume, because data is reorganized (or rewritten) | N/A | | Table operation | Truncate a table | Related to whether active transactions exist | N/A | | Table operation | Drop a table | Related to whether active transactions exist | N/A |
| Partition operation | Modify partitioning rules | Related to the data volume, because data is reorganized (or rewritten) | N/A | | Partition operation | Drop a partition | Related to whether active transactions exist | A partition-level table lock is added to the partition. | | Partition operation | Truncate a partition | Related to whether active transactions exist | A partition-level table lock is added to the partition. |

Contact Us