mysql异常排查

Posted by 大攀 on Wednesday, April 7, 2021

TOC

异常排查

MySQL宕机排查

  • 查看mysql的运行时常:show global status like ‘uptime’;

MySQL连接超时

  • show global variables like ‘%timeout’;

MySQL请求连接进程被主动Kill

  • show global status like ‘com_kill’;

SQL statement was too large

  • show global variables like ‘max_allowed_packet’;

  • 修改参数

    • set global max_allowed_packet=1024*1024*16;

零碎记录

AUTO_INCREMENT

AUTO_INCREMENT=1

UNION / UNION ALL

SELECT column_name(s) FROM table_name1 UNION ALL SELECT column_name(s) FROM table_name2

OR VS UNION ALL

https://bertwagner.com/posts/or-vs-union-all-is-one-better-for-performance/

主键自增步长

线上库默认都是步长为2用于防止主从切换出现主键冲突


comments powered by Disqus