title: Counting wide rows in Cassandra
body: <p>We are running Apache Cassandra 2.1.X and using Datastax driver. I've a use case where we need keep a count of various things. I came up with schema something like this:    </p>
  
  <pre><code>create table count{
  partitionKey bigInt,
  type text,
  uniqueId uuid,
  primary_key(partitionKey, type, uniqueId)
  </code></pre>
  
  <p>So this is nothing but wide rows. My question is if I do something like<br>
  <code>select count(uniqueId) from count where paritionKey=987 and type='someType'</code> and this returns back with say 150k count.     </p>
  
  <ul>
  <li><p>Will it be a expensive operation for Cassandra? Is there a better way to compute count like this. I also want to know  if anyone has solved something like this before? </p></li>
  <li><p>I would prefer to stay away from keeping counter as it's not that accurate and keeping count at application level is anyways doomed to fail.  </p></li>
  <li><p>Also it will great to know how does Cassandra internally compute such data.</p></li>
  </ul>
  
  <p>A big thanks to folks who help the community!</p>