performance of Replace vs If exists update else insert vs update if row_count()=0 insert
Usually the answer is simply "which one sends more requests to the server".


IODKU - 1
REPLACE - 1
EXISTS - 2 (SELECT, plus either UPDATE or INSERT)
ROW_COUNT - 1 or 2 (ROW_COUNT does not count)


But we have a tie with that metric.  So, let's dissect the winners:


IODKU - Find the row, decide what do, then do it.
REPLACE - DELETE all rows that match on any UNIQUE (or PRIMARY) KEY, then INSERT.


It feels like IODKU will be less work.