innodb big table delete

Try using a temp table approach. Try something like this :

Step 1) CREATE TABLE track_table_new LIKE track_table;

Step 2) INSERT INTO track_table_new SELECT * FROM track_table WHERE action='DELETE' AND date_insert >= DATE_SUB(CURDATE(), INTERVAL 30 day);

Step 3) ALTER TABLE track_table RENAME track_table_old;

Step 4) ALTER TABLE track_table_new RENAME track_table;

Step 5) DROP TABLE track_table_old;

I did not include the tuple field in Step 2. Please see if this produces the desired effect. If this is what you want, you may want to ditch the tuple field altogether unless you use the tuple field for other reasons.


슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...

1 Response

  1. I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.

페이스북/트위트/구글 계정으로 댓글 가능합니다.