Buy Percona ServicesBuy Now!

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

  • Filter
  • Time
  • Show
Clear All
new posts

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

    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.

  • #2
    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."