Cette rubrique explique comment consulter la vitesse d'exécution des instructions DDL et la progression de la construction des index colonne en mémoire (IMCI) dans les scénarios IMCI et InnoDB, notamment lors du traitement de tables volumineuses ou d'instructions DDL longues. Utilisez les tables système décrites ici pour surveiller la progression de la construction et la vitesse d'exécution pendant l'opération.
Scénario IMCI
Trois tables système présentent différents aspects de l'état des IMCI :
| Table | Informations affichées |
|---|---|
INFORMATION_SCHEMA.IMCI_INDEXES |
État actuel de chaque IMCI |
INFORMATION_SCHEMA.IMCI_INDEX_STATS |
Vitesse d'écriture de chaque IMCI |
INFORMATION_SCHEMA.IMCI_ASYNC_DDL_STATS |
Vitesse d'exécution des DDL et progression de la construction (tâches en cours uniquement) |
Une fois une tâche de construction terminée, sa ligne dans IMCI_ASYNC_DDL_STATS est supprimée sous 5 à 10 minutes. Pour vérifier l'état final d'un IMCI, interrogez INFORMATION_SCHEMA.IMCI_INDEXES.
Surveiller la progression de la construction
Exécutez la requête suivante pour afficher toutes les tâches de construction IMCI en cours :
SELECT
SCHEMA_NAME,
TABLE_NAME,
STATUS,
SCANNED_ROWS,
APPROXIMATE_ROWS,
AVG_SPEED,
SPEED_LAST_SECOND,
ESTIMATE_SECOND
FROM INFORMATION_SCHEMA.IMCI_ASYNC_DDL_STATS;
Pour surveiller une table spécifique, ajoutez une clause WHERE :
SELECT * FROM INFORMATION_SCHEMA.IMCI_ASYNC_DDL_STATS
WHERE SCHEMA_NAME = '<your_database>' AND TABLE_NAME = '<your_table>';
Continuez à interrogerIMCI_ASYNC_DDL_STATSjusqu'à la disparition de la ligne, puis confirmez l'état final dansIMCI_INDEXES. La ligne est effacée dans les 5 à 10 minutes suivant l'achèvement de la tâche.
Schéma de IMCI_ASYNC_DDL_STATS
Le schéma dépend de la version de votre cluster PolarDB for MySQL Enterprise Edition.
Version 8.0.1.x antérieure à 8.0.1.1.34, ou 8.0.2.x antérieure à 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
Version 8.0.1.x antérieure à 8.0.1.1.35, ou 8.0.2.x antérieure à 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
Notes d'utilisation
La valeur de
SPEED_LAST_SECONDvarie selon l'utilisation des ressources système et les tâches concurrentes.ESTIMATE_SECONDcorrespond au nombre de lignes restantes divisé parSPEED_LAST_SECONDet fluctue en conséquence. Si la limitation d'écriture réduit la vitesse de la dernière seconde à 0,ESTIMATE_SECONDprend la valeur9223372036854775807.
Scénario InnoDB
Lorsqu'une instruction DDL ajoute un IMCI ou construit un index, le nœud AP rejoue les journaux redo et écrit les données dans l'IMCI. Les performances du nœud AP dépendent de deux facteurs :
Vitesse de rejeu des journaux : consultez la surveillance des performances dans la console PolarDB.
Vitesse d'exécution des DDL sur le nœud principal : consultez les données de surveillance DDL fournies par InnoDB.
La surveillance des DDL InnoDB repose sur le module Performance Schema. Interrogez la table events_stages_current pour les instructions DDL en cours, ou la table events_stages_history pour les instructions terminées. Les métriques clés sont WORK_COMPLETED et WORK_ESTIMATED, toutes deux exprimées en pages.
Pour plus d'informations sur l'utilisation de Performance Schema afin de surveiller les opérations DDL, reportez-vous à la documentation MySQL.