当前位置:网站首页>How to use percona tool to add fields to MySQL table after interruption
How to use percona tool to add fields to MySQL table after interruption
2022-07-02 15:47:00 【Six element】
Catalog
demand
Now there is a MySQL database , There are many tens of millions of large watches in the Library , Now we need to add fields to a large table with tens of millions of levels of data
programme
Because the amount of table data is too large , adopt MySQL It is not advisable to add fields directly from the client command line , because : Modifying the table structure directly will lock the table , Because of the huge amount of data , Execution will be very slow , And it will affect the reading and writing of the table . Now most business systems , You need to make sure 7*24 Provide services hour after hour , Direct modification of large tables will lead to long-term table locking , Cause business interruption , Affect the business , This situation is definitely unacceptable .
So we need to find a feasible alternative , With , We use percona Tools for pt-online-change-schema Add field , This tool can modify the table structure with little impact on performance .
problem
Use pt-online-change-schema The process of adding fields is interrupted due to the connection , Adding fields failed , We re-use the tool to add fields, and the result is an error , The error information is as follows :

This error indicates that the trigger already exists .
analysis
We know how to use pt-online-change-schema Tools to give MySQL Adding fields to the table of will create three triggers (insert、update、delete), So we need to delete these three triggers before using the tool to add fields to the table .
Solution
1. Query triggers
select * from information_schema.triggers;
2. Delete trigger
Find the corresponding TRIGGER_SCHEMA and TRIGGER_NAME, such as
drop trigger test.pt_osc_test_t_tab1_ins;
drop trigger test.pt_osc_test_t_tab1_upd;
drop trigger test.pt_osc_test_t_tab1_del;3. Reuse pt-online-change-schema Add fields when the tool executes .
边栏推荐
- [leetcode] 876 intermediate node of linked list
- 奥比中光 astra: Could not open “2bc5/[email protected]/6“: Failed to set USB interface
- Digital collection system development (program development) - Digital Collection 3D modeling economic model system development source code
- 密码学基础知识
- Astra: could not open "2bc5/ [email protected] /6“: Failed to set USB interface
- 【Leetcode】167-两数之和II -输入有序数组
- Experiment collection of University "Fundamentals of circuit analysis". Experiment 6 - observation and measurement of typical signals
- Deux séquences ergodiques connues pour construire des arbres binaires
- How to intercept the value of a key from the JSON string returned by wechat?
- SQL FOREIGN KEY
猜你喜欢
![[development environment] install Visual Studio Ultimate 2013 development environment (download software | install software | run software)](/img/26/3f19d36c048e669c736e27384e0fa7.jpg)
[development environment] install Visual Studio Ultimate 2013 development environment (download software | install software | run software)

PHP static members

Pytoch saves tensor to Mat file

Ant group's large-scale map computing system tugraph passed the national evaluation

使用 percona 工具给 MySQL 表加字段中断后该如何操作

Review materials for the special topic of analog electronics with all essence: basic amplification circuit knowledge points

How to intercept the value of a key from the JSON string returned by wechat?

【Salesforce】如何确认你的Salesforce版本?

Why does the system convert the temp environment variable to a short file name?

Party History Documentary theme public welfare digital cultural and creative products officially launched
随机推荐
/bin/ld: 找不到 -lpam
奥比中光 astra: Could not open “2bc5/[email protected]/6“: Failed to set USB interface
Digital collection system development (program development) - Digital Collection 3D modeling economic model system development source code
高考录取分数线爬虫
《大学“电路分析基础”课程实验合集.实验六》丨典型信号的观察与测量
Lseek error
动态规划入门二(5.647.62)
Pyinstaller打包exe附带图片的方法
6090. 极大极小游戏
愛可可AI前沿推介(7.2)
lseek 出错
6092. Replace elements in the array
【LeetCode】19-删除链表的倒数第N个结点
2022 college students in Liaoning Province mathematical modeling a, B, C questions (related papers and model program code online disk download)
/bin/ld: 找不到 -lcrypto
Ant group's large-scale map computing system tugraph passed the national evaluation
《大学“电路分析基础”课程实验合集.实验四》丨线性电路特性的研究
【LeetCode】344-反转字符串
【LeetCode】1162-地图分析
【LeetCode】417-太平洋大西洋水流问题