This topic describes how to view the DDL execution speed and build progress for In-Memory Column Indexes (IMCIs) in the IMCI and InnoDB scenarios when large tables or time-consuming DDL statements are involved. Use the system tables described in this topic to monitor build progress and execution speed while the operation is in flight.
IMCI scenario
Three system tables expose different aspects of IMCI state:
| Table | What it shows |
|---|---|
INFORMATION_SCHEMA.IMCI_INDEXES | Current state of each IMCI |
INFORMATION_SCHEMA.IMCI_INDEX_STATS | Write speed of each IMCI |
INFORMATION_SCHEMA.IMCI_ASYNC_DDL_STATS | DDL execution speed and build progress (in-progress tasks only) |
After a build task completes, its row in IMCI_ASYNC_DDL_STATS is cleared within 5–10 minutes. To see the final state of an IMCI, query INFORMATION_SCHEMA.IMCI_INDEXES.
Monitor build progress
Run the following query to see all in-progress IMCI build tasks:
SELECT
SCHEMA_NAME,
TABLE_NAME,
STATUS,
SCANNED_ROWS,
APPROXIMATE_ROWS,
AVG_SPEED,
SPEED_LAST_SECOND,
ESTIMATE_SECOND
FROM INFORMATION_SCHEMA.IMCI_ASYNC_DDL_STATS;To monitor a specific table, add a WHERE clause:
SELECT * FROM INFORMATION_SCHEMA.IMCI_ASYNC_DDL_STATS
WHERE SCHEMA_NAME = '<your_database>' AND TABLE_NAME = '<your_table>';Keep queryingIMCI_ASYNC_DDL_STATSuntil the row disappears, then confirm the final state inIMCI_INDEXES. The row is cleared within 5–10 minutes after the task completes.
IMCI_ASYNC_DDL_STATS schema
The schema depends on your PolarDB for MySQL Enterprise Edition cluster version.
Version 8.0.1.x earlier than 8.0.1.1.34, or 8.0.2.x earlier than 8.0.2.2.15
CREATE TABLE: CREATE TEMPORARY TABLE `IMCI_ASYNC_DDL_STATS` (
`SCHEMA_NAME` varchar(193) NOT NULL DEFAULT '', -- The database name.
`TABLE_NAME` varchar(193) NOT NULL DEFAULT '', -- The table name.
`CREATED_AT` varchar(64) NOT NULL DEFAULT '', -- The timestamp when the task was created.
`STARTED_AT` varchar(64) NOT NULL DEFAULT '', -- The timestamp when the task starts.
`FINISHED_AT` varchar(64) NOT NULL DEFAULT '', -- The timestamp when the task ends.
`STATUS` varchar(128) NOT NULL DEFAULT '', -- The task status.
`APPROXIMATE_ROWS` bigint(8) NOT NULL DEFAULT '0', -- The estimated number of rows for baseline data.
`SCANNED_ROWS` bigint(8) NOT NULL DEFAULT '0', -- The number of scanned rows. The actual number may exceed the estimate.
`AVG_SPEED` int(4) NOT NULL DEFAULT '0', -- The average speed of the task. Unit: rows per second.
`SPEED_LAST_SECOND` int(4) NOT NULL DEFAULT '0', -- The scan speed in the last second. Unit: rows per second.
`ESTIMATE_SECOND` bigint(8) NOT NULL DEFAULT '0' -- The estimated remaining time. Unit: seconds. If write throttling is triggered, this value becomes 9223372036854775807 (INT64 MAX).
) ENGINE=MEMORY DEFAULT CHARSET=utf8Version 8.0.1.x earlier than 8.0.1.1.35, or 8.0.2.x earlier than 8.0.2.2.16
Create Table: CREATE TEMPORARY TABLE `IMCI_ASYNC_DDL_STATS` (
`SCHEMA_NAME` varchar(193) NOT NULL DEFAULT '', -- The database name.
`TABLE_NAME` varchar(193) NOT NULL DEFAULT '', -- The table name.
`CREATED_AT` varchar(64) NOT NULL DEFAULT '', -- The timestamp when the task was created.
`STARTED_AT` varchar(64) NOT NULL DEFAULT '', -- The timestamp when the task starts.
`FINISHED_AT` varchar(64) NOT NULL DEFAULT '', -- The timestamp when the task ends.
`STATUS` varchar(128) NOT NULL DEFAULT '', -- The task status.
`APPROXIMATE_ROWS` bigint(8) NOT NULL DEFAULT '0', -- The estimated number of rows for baseline data.
`SCANNED_ROWS` varchar(128) NOT NULL DEFAULT '', -- The number and percentage of scanned rows. The actual number may exceed the estimate.
`SCAN_SECOND` bigint(8) NOT NULL DEFAULT '0', -- The elapsed time for the scan phase. Unit: seconds.
`SORT_ROUNDS` bigint(8) NOT NULL DEFAULT '0', -- The number of sorting rounds. Applies only when sort keys are involved.
`SORT_SECOND` bigint(8) NOT NULL DEFAULT '0', -- The elapsed time for the sort phase. Unit: seconds. Applies only when sort keys are involved.
`BUILD_ROWS` varchar(128) NOT NULL DEFAULT '', -- The number and percentage of rows written after sorting. Applies only when sort keys are involved.
`BUILD_SECOND` bigint(8) NOT NULL DEFAULT '0', -- The elapsed time for writing data after sorting. Unit: seconds. Applies only when sort keys are involved.
`AVG_SPEED` int(4) NOT NULL DEFAULT '0', -- The average speed of the task. Unit: rows per second.
`SPEED_LAST_SECOND` int(4) NOT NULL DEFAULT '0', -- The speed in the last second. Unit: rows per second. Applies to the scanning and sorting phases.
`ESTIMATE_SECOND` bigint(8) NOT NULL DEFAULT '0' -- The estimated remaining time. Unit: seconds. Applies to the scanning and sorting phases. If write throttling is triggered, this value becomes 9223372036854775807 (INT64 MAX).
) ENGINE=MEMORY DEFAULT CHARSET=utf8Usage notes
SPEED_LAST_SECONDfluctuates with system resource usage and concurrent tasks.ESTIMATE_SECONDis calculated by dividing remaining rows bySPEED_LAST_SECOND. It fluctuates accordingly. When write throttling sets the last-second speed to 0,ESTIMATE_SECONDbecomes9223372036854775807.
InnoDB scenario
When a DDL statement adds an IMCI or builds an index, the AP node replays redo logs and writes data to the IMCI. AP node performance depends on two factors:
Log replay speed — check performance monitoring in the PolarDB console.
DDL execution speed on the primary node — check DDL monitoring data from InnoDB.
InnoDB DDL monitoring relies on the Performance Schema module. Query the events_stages_current table for DDL statements in progress, or the events_stages_history table for completed statements. The key metrics are WORK_COMPLETED and WORK_ESTIMATED, both measured in pages.
For details on using Performance Schema to monitor DDL operations, see MySQL documentation.