Subject | UPDATE/INSERT strategy |
---|---|
Author | burmair |
Post date | 2007-05-02T16:23:37Z |
Is it better to UPDATE, detect 0 rows affected, then INSERT
or INSERT, detect duplicate key, then UPDATE?
The INSERT will succeed once, while the UPDATE will succeed many
times, so it seems the first choice is better.
Or is there some other way to do this?
or INSERT, detect duplicate key, then UPDATE?
The INSERT will succeed once, while the UPDATE will succeed many
times, so it seems the first choice is better.
Or is there some other way to do this?