当前位置:网站首页>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] 283 move zero
- Wechat Alipay account system and payment interface business process
- Solve the problem of base64encoder error
- 2279. 装满石头的背包的最大数量
- 爱可可AI前沿推介(7.2)
- [leetcode] 876 intermediate node of linked list
- Moveit obstacle avoidance path planning demo
- SQL FOREIGN KEY
- Experiment collection of University "Fundamentals of circuit analysis". Experiment 7 - Research on sinusoidal steady-state circuit
- 士官类学校名录
猜你喜欢
Xpt2046 four wire resistive touch screen
XPT2046 四线电阻式触摸屏
Comparison between rstan Bayesian regression model and standard linear regression model of R language MCMC
自定义异常
Thoroughly understand browser strong cache and negotiation cache
[leetcode] 1254 - count the number of closed Islands
Ant group's large-scale map computing system tugraph passed the national evaluation
2022 年辽宁省大学生数学建模A、B、C题(相关论文及模型程序代码网盘下载)
【LeetCode】1905-统计子岛屿
Party History Documentary theme public welfare digital cultural and creative products officially launched
随机推荐
Astra: could not open "2bc5/ [email protected] /6“: Failed to set USB interface
/bin/ld: 找不到 -lxml2
Experiment collection of University "Fundamentals of circuit analysis". Experiment 7 - Research on sinusoidal steady-state circuit
解决BASE64Encoder报错的问题
List of sergeant schools
Two traversal sequences are known to construct binary trees
[idea] recommend an idea translation plug-in: translation "suggestions collection"
[leetcode] 1020 number of enclaves
Experiment collection of University Course "Fundamentals of circuit analysis". Experiment 5 - Research on equivalent circuit of linear active two terminal network
/bin/ld: 找不到 -lxslt
将点云坐标转换成世界坐标的demo
[leetcode] 1162 map analysis
[leetcode] 1905 statistics sub Island
(万字精华知识总结)Shell脚本编程基础知识
6091. 划分数组使最大差为 K
动态规划入门二(5.647.62)
爱可可AI前沿推介(7.2)
Finally, I understand the event loop, synchronous / asynchronous, micro task / macro task, and operation mechanism in JS (with test questions attached)
Loss function and positive and negative sample allocation: Yolo series
[leetcode] 577 reverse word III in string