title: Cassandra - difference in efficiency between simple and compound key
body: <p>I have a problem with understanding a one thing from this article - <a href="http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling" rel="nofollow">http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling</a></p>
  
  <p>Exercise - We want get all users by groupname.</p>
  
  <p>Solution:</p>
  
  <pre><code>CREATE TABLE groups (
      groupname text,
      username text,
      email text,
      age int,
      PRIMARY KEY (groupname, username)
  );
  
  SELECT * FROM groups WHERE groupname = 'footballers';
  </code></pre>
  
  <p>But to find all users in group we can set: <code>PRIMARY KEY (groupname)</code> and it work's also.</p>
  
  <p>Why is needed in this case a clustering key (username)? I know that when we set username as the clustering key we can use it in a <code>WHERE</code> clause. But to find users only by groupname is any difference between <code>PRIMARY KEY (groupname)</code> and <code>PRIMARY KEY (groupname, username)</code> in terms of query efficiency?</p>