最近帮助客户订正SQL时注意到alter的操作可能会锁表(MDL),所以也补一下online ddl的知识,避免不当的操作影响业务的运行。
Online DDL原理:
MySQL数据库操作中,DDL操作(比如CREATE,DROP,ALTER等)代价是非常高的,特别是在单表上千万的情况下,加个索引或改个列类型,就有可能堵塞整个表的读写。
【云栖社区】 【数据存储与数据库】 【mysql】 【innodb】 【LOG】 …
Ideas, releases, practical guides, and perspectives from the people building with MySQL.