title: cassandra counter table design: which design is better
body: <p>There are three keys and one counter:</p>
  <blockquote>
  <p>A: 300 values [A1-&gt;A300]</p>
  <p>B: 10 values [B1-&gt;B10]</p>
  <p>C: 400 values [C1-&gt;C400]</p>
  <p>counter count</p>
  </blockquote>
  <p>There are two designs:</p>
  <p>Design 1, primary key is <strong>((A, C), B)</strong>, (A, C) is partition key, B is cluster key</p>
  <p>query: <code>select count(*) from XXX where A = A1 and C in ( C91, C92, ..., C200) and B = B1</code></p>
  <p>Design 2, primary key is <strong>(A, B, C)</strong>, A is partition key, B and C are cluster keys</p>
  <p>query: <code>select count(*) from XXX where A = A1 and B = B1 and C &lt;= C200 and C&gt; C90</code></p>
  <p>I have two questions:</p>
  <p>Q1, As for the queries similar to <code>select count(*) from XXX where A = A1 and B = B1 and C &lt;= C200 and C&gt; C90</code> (A1, B1, C200 and C90 are random), in the above two primary key design, which is better?</p>
  <p>Q2, how many values in <code>IN ()</code> can be supported?</p>
  <p>Any comments welcomed. Thanks.</p>