Which SQL is Better? on MySQL 5.1
In MySQL INSERT
- REPLACE INTO
- 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.
精彩评论