您的位置 首页 Linux面试题

以下语句需要如何评估后上线执行,请写审核SQL要点 -mysql 面试题

02 研发同学需要紧急上线,需要DBA审核SQL,请问以下语句需要如何评估后上线执行,请写审核SQL要点

alter table t_enter_cooperate_info add account_day  INT not null default 0 comment '账期天数',
alter table t_enter_cooperate_info add account_detay_day INT not null default 0 comment '账期付款天数',
alter table t_pop_basic add account_day INT not null default 0 comment '账期天数',
alter table t_pop_basic add account_detay_day INT not null default 0 comment '账期付款天数'

问题解答分析:

本身语句是没有任何问题的,但需要说明,尽量业务繁忙时不要进行发布,选择夜里业务不繁忙时进行发布;

在进行SQL语句信息审核时,需要了解SQL语句的含义和作用:

alter table t_enter_cooperate_info add account_day  INT not null default 0 comment '账期天数',
alter table t_enter_cooperate_info add account_detay_day INT not null default 0 comment '账期付款天数',
-- 表示在t_enter_cooperate_info表中 添加两列信息 并设置相应属性和注释信息
​
alter table t_pop_basic add account_day INT not null default 0 comment '账期天数',
alter table t_pop_basic add account_detay_day INT not null default 0 comment '账期付款天数'
-- 表示在t_pop_basic add表中 添加两列信息 并设置相应属性和注释信息

通过对以上SQL语句信息解读,可以看出语句操作属于DDL操作,线上操作DDL语句可能会产生比较严重的锁进制等待(死锁问题);

可以结合企业的数据业务存储的负载压力(TPS),可能当前时间段的TPS数值较高,原则上不建议进行线上操作;

但是考虑到业务需求的紧急情况,建议使用PT-osc工具进行数据库线上操作,减少对线上业务的影响,但不能提高操作效率;

欢迎来撩 : 汇总all

白眉大叔

关于白眉大叔linux云计算: 白眉大叔

热门文章