MySql performance: INSERT ... ON DUPLICATE KEY UPDATE or UPDATE & ROW_COUNT

I request that in most cases the existing record will be updated. However, I need to check if these entries exist, and if not, I have to create it.

Normally, I would use it INSERT...ON DUPLICATE KEY UPDAT, but since only a few queries are required, I thought about doing it UPDATEand the last check if the returned one ROW_COUNT()is zero and does INSERTin this case.

What will give me the best performance?

+3
source share
1 answer

MySQL REPLACE INTO, , . , UPDATE ROW_COUNT() , , .

+1

All Articles