Can I use pt-online-schema-change to change a prim

2019-07-28 18:56发布

问题:

I'm considering using pt-online-schema-change to ALTER a primary key (changing it from one column, to a composite primary index) of a table. Are there any limitations to doing this? The documentation states

In most cases the tool will refuse to operate unless a PRIMARY KEY or UNIQUE INDEX is present in the table. See --alter for details.

回答1:

Well, don't do that. Running pt-online-schema-change on a table w/o a single column unique index, may result in a loss of data. See #3 here: http://www.pythian.com/blog/important-caveats-when-using-pt-online-schema-change/