当前位置:网站首页>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 .
边栏推荐
- [idea] recommend an idea translation plug-in: translation "suggestions collection"
- 6095. Strong password checker II
- ssh/scp 使不提示 All activities are monitored and reported.
- 【LeetCode】189-轮转数组
- 6090. 极大极小游戏
- 2022 年辽宁省大学生数学建模A、B、C题(相关论文及模型程序代码网盘下载)
- (5) Flink's table API and SQL update mode and Kafka connector case
- [leetcode] 283 move zero
- [leetcode] 344 reverse string
- (Video + graphic) machine learning introduction series - Chapter 5 machine learning practice
猜你喜欢

【LeetCode】1162-地图分析

蚂蚁集团大规模图计算系统TuGraph通过国家级评测
![[leetcode] 417 - Pacific Atlantic current problem](/img/30/c541bc1e81eb4e348ca11116a05e84.png)
[leetcode] 417 - Pacific Atlantic current problem

已知兩種遍曆序列構造二叉樹

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

Aike AI frontier promotion (7.2)

【Experience Cloud】如何在VsCode中取得Experience Cloud的MetaData

Wechat Alipay account system and payment interface business process

爱可可AI前沿推介(7.2)

How to intercept the value of a key from the JSON string returned by wechat?
随机推荐
2278. 字母在字符串中的百分比
Pyinstaller打包exe附带图片的方法
PHP static members
【Experience Cloud】如何在VsCode中取得Experience Cloud的MetaData
Soul torture, what is AQS???
Demo of converting point cloud coordinates to world coordinates
Moveit 避障路径规划 demo
愛可可AI前沿推介(7.2)
Deux séquences ergodiques connues pour construire des arbres binaires
《大学“电路分析基础”课程实验合集.实验五》丨线性有源二端网络等效电路的研究
[leetcode] 977 square of ordered array
2022 年辽宁省大学生数学建模A、B、C题(相关论文及模型程序代码网盘下载)
Fiddler实现手机抓包——入门
Wise target detection 23 - pytoch builds SSD target detection platform
[leetcode] 200 number of islands
[leetcode] 977 - carré du tableau ordonné
【LeetCode】1140-石子游戏II
6092. Replace elements in the array
已知兩種遍曆序列構造二叉樹
【LeetCode】344-反转字符串