Attempted translation of the above question from non-native English to English:
This is a question about the fastest method to use when inserting a value into a database when the value may already be in the database. INSERT will fail when the value is there and UPDATE will fail when it is not. Which of these choices is the most desirable?
- Do SELECT first and choose INSERT or UPDATE.
- INSERT first and use UPDATE if it had a duplicate error.
If there are other good choices besides the above, please teach me.
The environment uses MySQL 4.1.