Wide column pagination in CQL table

82 Views Asked by At

Let say i have this table

CREATE TABLE comments
(
    postId uuid,
    commentId timeuuid,
    postedBy text,
    postedById uuid,
    text text,
    blocked boolean,
    anonymous boolean,
    PRIMARY KEY(postId, commentId)
)

How can I perform wide column pagination on this table something like :

SELECT * FROM comments WHERE postId = '123' AND commentId > '34566'

I was going through Automatic Paging but confused with three approaches mentioned in this document that which should I use

2

There are 2 best solutions below

5
On BEST ANSWER

If you want to compare field for timeuuid, you need to using the expression like below:

SELECT * FROM comments WHERE postId = '123' AND commentId > maxTimeuuid('2013-08-01 15:05-0500') 
0
On

Once you've received the ResultSet from the execute method, you should be able to simply iterate over it using the iterator method. Pagination will happen automatically, based on the value specified in setFetchSize or the default value of 5000.