开发者

Which SQL is Better? on MySQL 5.1

开发者 https://www.devze.com 2022-12-18 20:56 出处:网络
In MySQL INSERT REPLACE INTO INSERT INTO .. ON DUPL开发者_JAVA技巧ICATE KEY UPDATE Which SQL is Better?

In MySQL INSERT

  1. REPLACE INTO
  2. INSERT INTO .. ON DUPL开发者_JAVA技巧ICATE KEY UPDATE

Which SQL is Better? Could you give me a advice?


Depends what you're doing with them. REPLACE INTO is technically faster since it doesn't have to do a read before updating (but that is mostly irrelevant), but I've felt that INSERT INTO ... ON DUPLICATE KEY UPDATE is generally more clear as to what you want to do.

Here is a short discussion in a blog.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号