Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra Limit 10,20 clause

Tags:

cassandra

I am using Cassandra 1.2.3 and can execute select query with Limit 10.

If I want records from 10 to 20, I cannot do "Limit 10,20".

Below query gives me an error.

select * from page_view_counts limit 10,20 

How can this be achieved?

Thanks Nikhil

like image 714
user1058797 Avatar asked Jun 10 '13 13:06

user1058797


1 Answers

You can't do skips like this in CQL. You have have to do paging by specifying a start place e.g.

select * from page_view_counts where field >= 'x' limit 10;

to get the next 10 elements starting from x.

I wrote a full example in this answer: Cassandra pagination: How to use get_slice to query a Cassandra 1.2 database from Python using the cql library.

like image 128
Richard Avatar answered Oct 19 '22 12:10

Richard