Quickest way to delete enormous MySQL table

前端 未结 11 2127
半阙折子戏
半阙折子戏 2020-12-23 12:28

I have an enormous MySQL (InnoDB) database with millions of rows in the sessions table that were created by an unrelated, malfunctioning crawler running on the same server a

11条回答
  •  無奈伤痛
    2020-12-23 13:07

    The best way I have found of doing this with MySQL is:

    DELETE from table_name LIMIT 1000;
    

    Or 10,000 (depending on how fast it happens).

    Put that in a loop until all the rows are deleted.

    Please do try this as it will actually work. It will take some time, but it will work.

提交回复
热议问题