I need to delete about 400 million rows from a 1.3 billion row table based on an indexed date field.
The table is about 800 GB in size.
What is the most efficient way to delete the data without causing adverse effects? The table is under heavy use, meaning lots of inserts and updates (which don't affect the rows to be deleted).
There is a maintenance window, which would be fastest, but I may not be able to get a big enough maintenance window. On the flip side, I can take my time with the delete, so there is no rush.
Step 2.you are basically inserting all data not yet in yournew_tablefrom theold_table. You might want to add anANDclause omitting the data you no longer need. – John K. N. Mar 14 '18 at 14:11