Basically I have a table with two-field primary key column (memberid, messageid) and I have a stored proc that inserts a new row into that table.
Right now I check if a row with the PK exists and insert if not, but I have already ran into situation when the row was inserted by a different process at the time right after the check and before the actual insert, so I'm thinking of an alternative way.
I DO NOT want to use transactions for performance reasons, so I was thinking of enclosing the INSERT into try-catch and skipping the check altogether. If the line already exists insert will fail but will be silenced by "catch" which is ok.
My question is - is throwing an error and catching it an expensive operation?