Rechercher dans le manuel MySQL
15.12 InnoDB and Online DDL
[+/-]
The online DDL feature provides support for instant and in-place table alterations and concurrent DML. Benefits of this feature include:
Improved responsiveness and availability in busy production environments, where making a table unavailable for minutes or hours is not practical.
For in-place operations, the ability to adjust the balance between performance and concurrency during DDL operations using the
LOCK
clause. See The LOCK clause.Less disk space usage and I/O overhead than the table-copy method.
ALGORITHM=INSTANT
support is available for
ADD COLUMN
and other operations in MySQL
8.0.12.
Typically, you do not need to do anything special to enable online DDL. By default, MySQL performs the operation instantly or in place, as permitted, with as little locking as possible.
You can control aspects of a DDL operation using the
ALGORITHM
and LOCK
clauses of
the ALTER TABLE
statement. These
clauses are placed at the end of the statement, separated from the
table and column specifications by commas. For example:
The LOCK
clause may be used for operations that
are performed in place and is useful for fine-tuning the degree of
concurrent access to the table during operations. Only
LOCK=DEFAULT
is supported for operations that are
performed instantly. The ALGORITHM
clause is
primarily intended for performance comparisons and as a fallback to
the older table-copying behavior in case you encounter any issues.
For example:
To avoid accidentally making the table unavailable for reads, writes, or both, during an in-place
ALTER TABLE
operation, specify a clause on theALTER TABLE
statement such asLOCK=NONE
(permit reads and writes) orLOCK=SHARED
(permit reads). The operation halts immediately if the requested level of concurrency is not available.To compare performance between algorithms, run a statement with
ALGORITHM=INSTANT
,ALGORITHM=INPLACE
andALGORITHM=COPY
. You can also run a statement with theold_alter_table
configuration option enabled to force the use ofALGORITHM=COPY
.To avoid tying up the server with an
ALTER TABLE
operation that copies the table, includeALGORITHM=INSTANT
orALGORITHM=INPLACE
. The statement halts immediately if it cannot use the specified algorithm.
Traduction non disponible
Le manuel MySQL n'est pas encore traduit en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Document créé le 26/06/2006, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/mysql-rf-innodb-online-ddl.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.