A DDL statement is executed as a DDL job in a PolarDB-X instance. You can execute the SHOW DDL statement to view DDL jobs in the PolarDB-X instance.

Syntax

SHOW [FULL] DDL;

Examples

SHOW DDL\G;
*************************** 1. row ***************************
           JOB_ID: 1359947811109470208
    OBJECT_SCHEMA: d1
      OBJECT_NAME: t2
           ENGINE: DAG
         DDL_TYPE: ALTER_TABLE
            STATE: PAUSED
BACKFILL_PROGRESS: 0%
 PHY_DDL_PROGRESS: 100%
         PROGRESS: 20%
       START_TIME: 2021-08-05 11:01:25.291
         END_TIME: 2021-08-05 11:02:27.020
 ELAPSED_TIME(MS): 61729
      PHY_PROCESS: 
       CANCELABLE: true
1 row in set (0.03 sec)

Response parameters

Parameter Description
JOB_ID The unique ID of the DDL job. The ID is a 64-bit signed integer of the LONG data type.
OBJECT_SCHEMA The schema name of the object on which the DDL job is performed.
OBJECT_NAME The name of the object on which the DDL job is performed. For example, the value can be the name of the table on which the DDL statement is executed.
ENGINE The engine type for the DDL job. Default value: DAG.
DDL_TYPE The type of the DDL job. Example: CREATE_TABLE.
STATE The state of the DDL job. For more information, see DDL job status.
BACKFILL_PROGRESS The progress of data backfilling in the DDL job.
PHY_DDL_PROGRESS The progress of batch physical DDL statements that are being executed in the DDL job.
PROGRESS The progress of the DDL job.
START_TIME The start time of the DDL job.
END_TIME The end time of the DDL job.
ELAPSED_TIME(MS) The time elapsed after the DDL job is started. Unit: milliseconds.
PHY_PROCESS The state of physical DDL statements that are being executed.
CANCELABLE Indicates whether the DDL job can be canceled by executing the CANCEL DDL statement.

DDL job status

The STATE field returned by the SHOW DDL statement indicates the state of the DDL job. The following figure shows the state changes.

456789

In most cases, the state of a DDL job changes in the following sequence: QUEUED, RUNNING, and COMPLETED.

If an exception occurs, a DDL job may be automatically rolled back. In this case, the state of the DDL job changes in the following sequence: QUEUED, RUNNING, ROLLBACK_RUNNING, and ROLLBACK_COMPLETED.