当前位置:网站首页>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-移动零
- (Video + graphic) machine learning introduction series - Chapter 5 machine learning practice
- [2. Basics of Delphi grammar] 3 Object Pascal constants and variables
- [leetcode] 19 delete the penultimate node of the linked list
- /bin/ld: 找不到 -lxml2
- 6092. 替换数组中的元素
- 怎样从微信返回的json字符串中截取某个key的值?
- 【LeetCode】486-预测赢家
- College entrance examination admission score line climbing
- [leetcode] 1254 - count the number of closed Islands
猜你喜欢
![[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)

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

PHP static members

Party History Documentary theme public welfare digital cultural and creative products officially launched

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

PTA 天梯赛习题集 L2-001 城市间紧急救援

Xpt2046 four wire resistive touch screen

(Video + graphic) machine learning introduction series - Chapter 5 machine learning practice

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

Aike AI frontier promotion (7.2)
随机推荐
2279. Maximum number of backpacks filled with stones
爱可可AI前沿推介(7.2)
Moveit obstacle avoidance path planning demo
Deux séquences ergodiques connues pour construire des arbres binaires
(万字精华知识总结)Shell脚本编程基础知识
已知兩種遍曆序列構造二叉樹
【Experience Cloud】如何在VsCode中取得Experience Cloud的MetaData
/bin/ld: 找不到 -lxslt
How to intercept the value of a key from the JSON string returned by wechat?
/bin/ld: 找不到 -lxml2
Two traversal sequences are known to construct binary trees
[leetcode] 1162 map analysis
[idea] recommend an idea translation plug-in: translation "suggestions collection"
Make p12 certificate [easy to understand]
【LeetCode】695-岛屿的最大面积
C # get PLC information (kepserver) II
Wechat Alipay account system and payment interface business process
夏季高考文化成绩一分一段表
【LeetCode】1020-飞地的数量
/bin/ld: 找不到 -lcrypto