textOnline DDL is only supported in MySQL 5.6. In versions 5.5 and earlier, using commands such as alter table/create index to modify the table structure will lock the table, which is obviously unacceptable in a production environment. In MySQL 5.7, Online DDL has been continuously optimized in terms of performance and stability. It has significant performance advantages, has little impact on business load, and has controllable downtime. Compared with pt-osc/gh-ost, it does not require the installation of third-party dependency packages. It also supports Online DDL of the Inplace algorithm. Since there is no need to copy tables, the required disk space is also smaller. Let's first look at a common DDL statement: ALTER TABLE tbl_name ADD PRIMARY KEY (column), ALGORITHM=INPLACE, LOCK=NONE; Among them, LOCK describes the degree of concurrency during the DDL operation, and ALGORITHM describes the implementation method of DDL. LOCK parameter
ALGORITHM parameters
COPY TABLE Process
At the same time, in order to maintain data consistency during this process, the table is locked and read-only during the intermediate data copying (Copy Table). If a write request comes in, the service will not be able to be provided, which will cause the number of connections to explode. IN-PLACE Process
During this process, the alter statement acquires the MDL write lock when it is started, but this write lock degenerates into a read lock before the data is actually copied. That is to say, during the most time-consuming process of copying data to a temporary file, the original table can be operated with DML. It is only locked during the final switching phase between the old and new tables. This rename process is very fast. Allow concurrent DML and DDL operations
Although Online DDL is allowed for operations marked as expensive cost, they will impose a high burden on the server IO and CPU. They will also cause replication blockage, which will cause another form of slave replication delay. Therefore, if the table is large, it is recommended to execute it during off-peak hours. DDL operations that do not allow concurrent DML
The above is the detailed content of the detailed explanation of the use of MySQL Online DDL. For more information about the use of MySQL Online DDL, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: Implementation process of the magnifying glass effect in the Javascript example project
>>: Make a nice flip login and registration interface based on html+css
Table of contents 1. Overview 2. Memory Managemen...
This article shares with you how to use canvas an...
Forwarding between two different servers Enable p...
I don't know if it's because the binary d...
Docker takes up a lot of space. Whenever we run c...
Compared with ordinary programs, dynamic link lib...
Table of contents 1. Introduction 2. Prototype ch...
This article example shares the specific code of ...
This is not actually an official document of IE. I...
For many domestic advertisers, the creation and ev...
Table of contents 1. Analysis of key source code ...
String functions Check the ascii code value of th...
Usually the pictures uploaded by users need to be...
Ubuntu 20.04 has been released, bringing many new...
For example, if I have a Jenkins server in my int...