title: Checking if record exist and exiting in most effective way
body: <p>I have following script inside my stored procedure</p>
  
  <pre><code>IF EXISTS(SELECT * FROM dbo.MBLPosition WHERE PositionGKey = @i_PositionGKey) RETURN
  
  -- DO SOME STUFF HERE
  
  INSERT dbo.MBLPosition..
  </code></pre>
  
  <p>I'm inserting some data into table (single record). First I check if it exist already, then I do some processing and insert record.</p>
  
  <p>Processing can take some time - let's say 2 seconds. Some times calls come in subsequently and I get constraint exceptions. Rare, but happens. I want to avoid this and at the same time I don't want to do this processing if record already exist. What is the best way to structure this code so I don't do extra work and avoid exception?</p>
  
  <p>This is large table with records coming in all the time. What is the best way to filter out dupes as they come in and don't spend much processing time?</p>