title: How bad is ignoring Oracle DUP_VAL_ON_INDEX exception?
body: <p>I have a table where I'm recording if a user has viewed an object at least once, hence:</p>
  
  <pre><code> HasViewed
       ObjectID  number (FK to Object table)
       UserId    number (FK to Users table)
  </code></pre>
  
  <p>Both fields are NOT NULL and together form the Primary Key.</p>
  
  <p>My question is, since I don't care how many times someone has viewed an object (after the first), I have two options for handling inserts.</p>
  
  <ul>
  <li>Do a SELECT count(*) ... and if no records are found, insert a new record.</li>
  <li>Always just insert a record, and if it throws a DUP_VAL_ON_INDEX exceptions (indicating that there already was such a record), just ignore it.</li>
  </ul>
  
  <p>What's the downside of choosing the second option?</p>
  
  <p>UPDATE:</p>
  
  <p>I guess the best way to put it is : "Is the overhead caused by the exception worse than the overhead caused by the initial select?"</p>