Not the answer you need?
Register and ask your own question!

How do I run optimize with pt-online-schema-change?

cesarsjcesarsj ContributorCurrent User Role Contributor
I want to decrease the size of disk space occupied by some tables. For that, I want to run optimize (any better ideas?).

How would I optimize with the pt-online-schema-change command? The option would be --alter = "ENGINE = InnoDB", same as shown below?

pt-online-schema-change --alter = "ENGINE=InnoDB" --analyze-before-swap --user=<user> --password=<password> --execute D=<database>, t=<table >;

I'm running the command like this, and the error is returning me:The new table `<database>` .`_ <table> _new` does not have a PRIMARY KEY or a unique index which is required for the DELETE trigger.Please check you have at least one UNIQUE and NOT NULLABLE index.


  • cesarsjcesarsj Contributor Current User Role Contributor
    The manual says:

    "In almost all cases a PRIMARY KEY or UNIQUE INDEX needs to be present in the table. This is necessary because the tool creates a DELETE trigger to keep the new table updated while the process is running."
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.