# Delete many rows from a large percona mysql db

**URL:** <https://forums.percona.com/t/delete-many-rows-from-a-large-percona-mysql-db/5080>\
**Category:** General Questions\
**Created:** [September 14, 2016, 5:50am UTC](https://forums.percona.com/t/delete-many-rows-from-a-large-percona-mysql-db/5080 "2016-09-14T05:50:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![An\_An](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@An\_An](https://forums.percona.com/u/An_An)\
**Post date:** [September 14, 2016, 5:50am UTC](https://forums.percona.com/t/delete-many-rows-from-a-large-percona-mysql-db/5080/1 "2016-09-14T05:50:05Z")

</div>

Hello,

I need a fresh opinion on the case. Any thoughts are appreciated.

Input: we have a huge percona mysql (5.5) database that takes a couple of Tb (terabytes). Tables on innodb engine.  
More than a half (2/3) of that size should be deleted as quick as possible.  
Also we have master-slave configuration.

As the quickest way to achieve that I am considering the following solution:  
Execute for each table on the slave server (to avoid production downtime) :

1. Stop replication
2. Select the rows NOT to be deleted into an empty new table that has the same structure as the original table
3. Rename original table to “table\_old”, new table - to correct name
4. Drop the original table “table\_old”
5. Start replication

The problem is that we have a lot of FK constraints. Also I am afraid to break the replication during this process.

Questions:

1. What the potential problems can be with FK constraints in this solution? I do not want to disable FK checks.
2. How do not break replication?
3. Opinions? Alternative solutions?

Thank you in advance.
