I have two tables on MySQL:
HISTORY_TABLE(4 million rows) (column1 indexed)
EXTRACT_TABLE(600K rows) (column1 indexed)
EXTRACT_TABLE.column1 there are multiple
Objective: I want to delete all records that MATCH criteria:
HISTORY_TABLE.column1 = EXTRACT_TABLE.column1
I tried two different possibilities:
- Simple query that matches criteria (10 hours)
- Copying the
NOT EXISTSrows into a new table (2days+)
I found via searching that deletion can be done in chunks with a stored procedure, but I don't know how.
Is there an example on how to do a cursor based on
EXTRACT_TABLE to read in chunks and delete the other table? Or is there other way to accomplish my objective?