pt-online-schema-change

pt-online-schema-change alters a table’s structure without blocking reads or writes. Specify the database and table in the DSN. Do not use this tool before reading its documentation and checking your backups carefully.

详情链接:https://www.cnblogs.com/dbabd/p/10605629.html

  1. time pt-online-schema-change \
  2. --alter 'ADD COLUMN (name2 varchar(64),trustee_add_time INT (10) UNSIGNED NOT NULL DEFAULT "0" COMMENT "晋升董事的时间",manager_add_time INT (11) UNSIGNED DEFAULT "0" COMMENT "升级为经理的时间")' \
  3. h=192.168.0.12,P=63306,p=Password6,u=root,D=sbtest,t=sbtest2,S=/tmp/mysql63306.sock \
  4. --charset=utf8mb4 --execute

使用sysbench生成的8,000,000测试数据后,pt-online-secheme-change执行上述命令的结果
image.png