How much downtime can you incur? How big are the lines? How much do you delete?
Simply put, deleting rows is one of the most expensive things you can do for a table. This is just a terrible thing.
If you do not need to do this, and you have disk space for it, and your queries are not affected by the size of the table (well-indexed queries usually ignore the size of the table), then you can just leave it pretty good alone.
If you have such an opportunity and you can disconnect the table offline (and you delete a good percentage of the table), then it is best to copy the rows you want to save to the new table, discard the old one, rename the new one to the old name and THEN re-create your indices.
Otherwise, you are very stuck in a good distance.
source
share