title: Cassandra: How to know if operation was insert or update
body: <p>In order to minimize number of queries I use only UPDATE method in my application:</p>
  
  <pre><code>UPDATE lp_registry.domain SET dr = ?, ud = dateOf(now()) WHERE d1 = ? AND d2 = ? AND d3 = ?
  </code></pre>
  
  <p>If a row with corresponding primary key d1,d2,d3 doesn't exist, then it is automatically created and that is what I want.</p>
  
  <p>But what I also want is to know, if the row was inserted or updated. I've read in <a href="http://docs.datastax.com/en/cql/3.1/cql/cql_reference/update_r.html" rel="nofollow">cassandra documentation</a> about IF EXIST and 'applied' result. However this:</p>
  
  <pre><code>UPDATE lp_registry.domain SET dr = ?, ud = dateOf(now()) WHERE d1 = ? AND d2 = ? AND d3 = ? IF EXISTS
  </code></pre>
  
  <p>won't peform to operation if the row doesn't exist.</p>
  
  <p>Is there any way how to do UPSERT without (SELECT and (INSERT or UPDATE)) and keep a track about insertion or update of the row?</p>