Unique Constraint (Or) Insert if not exist which is Safer - Multi-thread environment

Viewed 184

I saw in many applications they are using unique constraint as well as in some applications instead of using unique constraint they are using insert if not exist query

In a multi-threaded environment where there is a chance of multiple thread trying to insert at the same time..may be same second or millisecond too...

In such a case, which option would be the best ?? Going for a unique constraint or going for insert if not exist.

Thanks.

1 Answers
Related