title: Cassandra CQL paging for Composite key
body: <p>Is there is any easy way to query wide row by paging. My schema is,</p>
  
  <pre><code>CREATE TABLE USER_LIKED_ITEMS (
  user_id text,
  event_id text,
  item_id text,
  description text,
  PRIMARY KEY(user_id, event_id, item_id)
  );
  </code></pre>
  
  <p>I want to get all the rows for the given user_id (consider there are <strong>500000 rows for a given user_id</strong> with various combination of event_id and item_id) through paging with a count 25. The query I have tried is <code>select * from USER_LIKED_ITEMS where user_id = '101' LIMIT 25;</code> Once results is arrived then 25th record has a value </p>
  
  <pre><code>user_id = 101,
  event_id = 25,
  item_id = 25,
  description = XXXXX
  </code></pre>
  
  <p>My next query is, <code>select * from USER_LIKED_ITEMS where user_id = '101' and event_id = '25' and item_id &gt; '25' LIMIT 25;</code> Retrieves the results of 10 records having the last record value like, </p>
  
  <pre><code>user_id = 101,
  event_id = 25,
  item_id = 35,
  description = XXXXX
  </code></pre>
  
  <p>So again I need to frame <code>select * from USER_LIKED_ITEMS where user_id = '101' and event_id &gt; '25'</code>. So It is quite tricky and difficult to retrieve all the results by framing different query to retrieve all the results. Is there is any easy way to get all the record for the given user_id with pagination count of 25? I am using cassandra-1.2.15 and cassandra-driver-core-1.0.3.jar. Cassandra2.0 has paging support, but I am not allowed to upgrade cassandra version.</p>