MySQL statement:
INSERT ... ON DUPLICATE KEY UPDATE ...
appears like a single statement that should be thread-safe (in the sense that no concurrent query on the same data can happen during its execution). But on the other hand, it could be internally decomposed into insert and update statements, and I'm wondering if it's still guaranteed to be thread safe?
I mean, for example, could there be a delete in between the insertand update coming from a concurrent thread that would cause the update to fail?
I think insert on duplicate key update should be thread safe, but the docs do not seem to state it in clear text. Could anyone please provide a proof link on the subject? How is it internally implemented?