pt-online-schema-change

Would the following primary key change work with `pt-online-schema-change`?

心不动则不痛 提交于 2019-12-11 20:51:05
问题 This is a follow-up of Can I use pt-online-schema-change to change a primary key?. Goal: I'd like to ALTER a table's primary key using pt-online-schema-change. Specifically I want migrate from single-column primary key (a) to a composite primary key (a,b) (where a is the same column in both cases). Idea: I understand pt-online-schema-change generally doesn't work when both primary key and unique key is missing. My plan is therefor to do the following: Add a unique key: pt-online-schema-change

Can I use pt-online-schema-change to change a primary key?

独自空忆成欢 提交于 2019-12-11 09:17:55
问题 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