Este tópico descreve como visualizar a velocidade de execução de DDL e o progresso de compilação de In-Memory Column Indexes (IMCIs) nos cenários IMCI e InnoDB, especialmente em tabelas grandes ou instruções DDL demoradas. Use as tabelas de sistema descritas neste documento para monitorar o progresso da compilação e a velocidade de execução durante a operação.
Cenário IMCI
Três tabelas de sistema exibem diferentes aspectos do estado do IMCI:
|
Tabela |
Descrição |
|
|
Estado atual de cada IMCI |
|
|
Velocidade de gravação de cada IMCI |
|
|
Velocidade de execução de DDL e progresso de compilação (apenas tarefas em andamento) |
Após a conclusão de uma tarefa de compilação, a linha correspondente em IMCI_ASYNC_DDL_STATS é removida dentro de 5 a 10 minutos. Para verificar o estado final de um IMCI, consulte INFORMATION_SCHEMA.IMCI_INDEXES.
Monitorar o progresso da compilação
Execute a consulta a seguir para visualizar todas as tarefas de compilação de IMCI em andamento:
SELECT
SCHEMA_NAME,
TABLE_NAME,
STATUS,
SCANNED_ROWS,
APPROXIMATE_ROWS,
AVG_SPEED,
SPEED_LAST_SECOND,
ESTIMATE_SECOND
FROM INFORMATION_SCHEMA.IMCI_ASYNC_DDL_STATS;
Para monitorar uma tabela específica, adicione uma cláusula WHERE:
SELECT * FROM INFORMATION_SCHEMA.IMCI_ASYNC_DDL_STATS
WHERE SCHEMA_NAME = '<your_database>' AND TABLE_NAME = '<your_table>';
Continue consultandoIMCI_ASYNC_DDL_STATSaté que a linha desapareça e confirme o estado final emIMCI_INDEXES. A linha é removida entre 5 e 10 minutos após a conclusão da tarefa.
Schema de IMCI_ASYNC_DDL_STATS
O schema depende da versão do seu cluster PolarDB for MySQL Enterprise Edition.
Versão 8.0.1.x anterior à 8.0.1.1.34 ou 8.0.2.x anterior à 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=utf8
Versão 8.0.1.x anterior à 8.0.1.1.35 ou 8.0.2.x anterior à 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=utf8
Observações de uso
O valor de
SPEED_LAST_SECONDvaria conforme o uso de recursos do sistema e as tarefas simultâneas.ESTIMATE_SECONDresulta da divisão das linhas restantes porSPEED_LAST_SECONDe também sofre flutuações. Se o limitador de gravação reduzir a velocidade do último segundo para zero,ESTIMATE_SECONDassumirá o valor9223372036854775807.
Cenário InnoDB
Quando uma instrução DDL adiciona um IMCI ou cria um índice, o nó AP reproduz os redo logs e grava dados no IMCI. O desempenho do nó AP depende de dois fatores:
Velocidade de reprodução de log: verifique o monitoramento de desempenho no console do PolarDB.
Velocidade de execução de DDL no nó primário: consulte os dados de monitoramento de DDL do InnoDB.
O monitoramento de DDL do InnoDB baseia-se no módulo Performance Schema. Consulte a tabela events_stages_current para instruções DDL em andamento ou a tabela events_stages_history para instruções concluídas. As principais métricas são WORK_COMPLETED e WORK_ESTIMATED, ambas medidas em páginas.
Para obter detalhes sobre como usar o Performance Schema para monitorar operações DDL, consulte a documentação do MySQL.