title: Understanding Cassandra Composite keys
body: <p>I just watched <a href="http://www.youtube.com/watch?v=HdJlsOZVGwM">this youtube video of Patrick McFadin</a> on cassandra datamodelling.</p>
  
  <p>There was one table, as follows: </p>
  
  <pre><code>create table user_activity_history {
    username varchar,
    interaction_date varchar,
    activity_code varchar,
    detail varchar,
    PRIMARY KEY((username,interaction_date),interaction_time)
  );
  </code></pre>
  
  <p>Why is the primary key <code>((username,interaction_date),interaction_time)</code>.
  How is that different from <code>(username,interaction_date,interaction_time)</code>.</p>