Delete, Truncate or Drop to clean out a table in MySQL

前端 未结 6 558
野性不改
野性不改 2021-02-07 03:49

I am attempting to clean out a table but not get rid of the actual structure of the table. I have an id column that is auto-incrementing; I don\'t need to keep the

6条回答
  •  [愿得一人]
    2021-02-07 03:59

    I've just come across a situation where DELETE is drastically affecting SELECT performance compared to TRUNCATE on a full-text InnoDB query.

    If I DELETE all rows and then repopulate the table (1million rows), a typical query takes 1s to come back.

    If instead I TRUNCATE the table, and repopulate it in exactly the same way, a typical query takes 0.05s to come back.

    YMMV, but for whatever reason for me on MariaDB 10.3.15-MariaDB-log DELETE seems to be ruining my index.

提交回复
热议问题