# pt-online-schema-change and documentation confusion

**URL:** <https://forums.percona.com/t/pt-online-schema-change-and-documentation-confusion/2567>\
**Category:** Percona Toolkit\
**Created:** [July 11, 2012, 3:23am UTC](https://forums.percona.com/t/pt-online-schema-change-and-documentation-confusion/2567 "2012-07-11T03:23:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![WheresWardy](https://avatars.discourse-cdn.com/v4/letter/w/db5fbb/32.png) [@WheresWardy](https://forums.percona.com/u/WheresWardy)\
**Post date:** [July 11, 2012, 3:23am UTC](https://forums.percona.com/t/pt-online-schema-change-and-documentation-confusion/2567/1 "2012-07-11T03:23:06Z")

</div>

In the documentation, --alter-foreign-keys-method says that using drop\_swap will drop the original table before renaming the new one in to place. However, it also says that --no-drop-old-table will be enforced, which suggests that the old table won’t be dropped.

As I understand it, the documentation suggests that the process happens as such:

LOCK TABLES table WRITE;SET FOREIGN\_KEY\_CHECKS = 0;DROP TABLE table;RENAME TABLE table\_new TO table;SET FOREIGN\_KEY\_CHECKS = 1;UNLOCK TABLES table;

However, if the table is very large (say, hundreds of GBs) then the drop operation could take quite a long time and block whilst it’s being performed. Unless there’s something I’m missing with regards to foreign keys, surely it would be much better to obey the --no-drop-old-table, not perform the drop (and rename the original table to \_old instead), and let us drop the old table afterwards when it won’t block?

---

<div class="post-metadata">

**Author:** ![xaprb](https://avatars.discourse-cdn.com/v4/letter/x/49beb7/32.png) [@xaprb](https://forums.percona.com/u/xaprb)\
**Post date:** [July 12, 2012, 7:28am UTC](https://forums.percona.com/t/pt-online-schema-change-and-documentation-confusion/2567/2 "2012-07-12T07:28:26Z")

</div>

We can’t rename the table to \_old because the foreign keys would then point to \_old.

---

<div class="post-metadata">

**Author:** ![WheresWardy](https://avatars.discourse-cdn.com/v4/letter/w/db5fbb/32.png) [@WheresWardy](https://forums.percona.com/u/WheresWardy)\
**Post date:** [July 12, 2012, 9:34am UTC](https://forums.percona.com/t/pt-online-schema-change-and-documentation-confusion/2567/3 "2012-07-12T09:34:57Z")

</div>

I thought that might be the case. Is there any way we can perform online changes to large tables with foreign keys? As far as I can tell either modifying the foreign keys or dropping the table will block for an unacceptably large amount of time (assuming the delete operation will take a few minutes to perform), and because of the nature of pt-online-schema-change we can’t “schedule” the drop for any particular time.
