This depends on how you are doing the checking.
When you do a select before the insert, you have a race condition. Another user/thread could insert a duplicate record between the select and insert. That is why you want to do the check in the insert.
In general, it is sufficient to do the check in the insert. If you want to avoid the error, use on duplicate key update. This is preferable to insert ignore, because on duplicate key update only handles errors regarding key duplication. Insert ignore ignores all errors.
I would say not to bother with the check before hand, unless you have some particular reason. Here are some reasons:
- You want to minimize the time that the table is locked, so you want to avoid asking questions such as "how long is the table locked when a duplicate occurs?".
- Intentional holes in your auto_increment columns bother you (actually, I'm not sure if this is an issue with MySQL).
- You are inserting multiple rows and want the ability to detect multiple duplicates for reporting back to users.