ALTER TABLE without locking the table?

后端 未结 19 1999
梦毁少年i
梦毁少年i 2020-11-30 17:41

When doing an ALTER TABLE statement in MySQL, the whole table is read-locked (allowing concurrent reads, but prohibiting concurrent writes) for the duration of the statement

19条回答
  •  失恋的感觉
    2020-11-30 18:12

    Not really.

    You ARE altering the underlying structure of the table, after all, and that's a bit of information that's quite important to the underlying system. You're also (likely) moving much of the data around on disk.

    If you plan on doing this a lot, you're better off simply padding the table with "dummy" columns that are available for future use.

提交回复
热议问题