MySQL performance DELETE or UPDATE?

前端 未结 5 1674
旧巷少年郎
旧巷少年郎 2021-02-14 22:14

I have a MyISAM table with more than 10^7 rows. When adding data to it, I have to update ~10 rows at the end. Is it faster to delete them and then insert the new ones, or is it

5条回答
  •  灰色年华
    2021-02-14 23:08

    Logically DELETE+ADD = 2 actions, UPDATE = 1 action. Also deleting and adding new changes records IDs on auto_increment, so if those records have relationships that would be broken, or would need updates too. I'd go for UPDATE.

提交回复
热议问题