You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Snehal Nagmote <na...@gmail.com> on 2013/01/09 23:51:46 UTC

Pagination over row Keys in Cassandra using Kundera/CQL queries

Hello All,

I am using Kundera 2.0.7 and Cassandra 1.0.8. I need to implement batching/
pagination over row keys.

for instance, Scan columnfamily , get 100 records in batch everytime , till
all keys are exhausted.

I am using random partitioner for keyspace. I explored  limit option in cql
and ,setMaxresults() , but It doesnt give me ability to do range scan over
row keys .

One option I can think of is Storing those row keys in separate column
family as columns and do range queries on column.

Is there any best practice to achieve this ?

Any help ?


Thanks,
Snehal

Re: Pagination over row Keys in Cassandra using Kundera/CQL queries

Posted by aaron morton <aa...@thelastpickle.com>.
Its the same idea. 

If you want to get 50 columns ask for 51, iterate over the first 50 and use the 51st as the first column for the next page. If you get < 51 column then you are at the end of the page. 

I've not used Kundera so cannot talk about specifics. 

Cheers

-----------------
Aaron Morton
Freelance Cassandra Developer
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 11/01/2013, at 7:20 AM, Snehal Nagmote <na...@gmail.com> wrote:

> Thank you Aaron , that link helps.
> 
> However, In my application ,  I am using jpa(Kundera)  to query cassandra.
> 
> Is there a way to achieve this in cql or jpa query language? 
> 
> Thanks,
> Snehal
> 
> On 9 January 2013 16:28, aaron morton <aa...@thelastpickle.com> wrote:
> Try this http://wiki.apache.org/cassandra/FAQ#iter_world
> 
> Take a look at the code examples it points to. 
> 
> Cheers
> 
> -----------------
> Aaron Morton
> Freelance Cassandra Developer
> New Zealand
> 
> @aaronmorton
> http://www.thelastpickle.com
> 
> On 10/01/2013, at 11:55 AM, Snehal Nagmote <na...@gmail.com> wrote:
> 
>> Hello All,
>> 
>> I am using Kundera 2.0.7 and Cassandra 1.0.8. I need to implement batching/ pagination over row keys.  
>> 
>> for instance, Scan columnfamily , get 100 records in batch everytime , till all keys are exhausted.
>> 
>> I am using random partitioner for keyspace. I explored  limit option in cql and ,setMaxresults() , but It doesnt give me ability to do range scan over row keys . 
>> 
>> One option I can think of is Storing those row keys in separate column family as columns and do range queries on column.
>> 
>> Is there any best practice to achieve this ?
>> 
>> Any help ?
>> 
>> 
>> Thanks,
>> Snehal
>> 
> 
> 


Re: Pagination over row Keys in Cassandra using Kundera/CQL queries

Posted by Snehal Nagmote <na...@gmail.com>.
Thank you Aaron , that link helps.

However, In my application ,  I am using jpa(Kundera)  to query cassandra.

Is there a way to achieve this in cql or jpa query language?

Thanks,
Snehal

On 9 January 2013 16:28, aaron morton <aa...@thelastpickle.com> wrote:

> Try this http://wiki.apache.org/cassandra/FAQ#iter_world
>
> Take a look at the code examples it points to.
>
> Cheers
>
> -----------------
> Aaron Morton
> Freelance Cassandra Developer
> New Zealand
>
> @aaronmorton
> http://www.thelastpickle.com
>
> On 10/01/2013, at 11:55 AM, Snehal Nagmote <na...@gmail.com>
> wrote:
>
> Hello All,
>
> I am using Kundera 2.0.7 and Cassandra 1.0.8. I need to implement
> batching/ pagination over row keys.
>
> for instance, Scan columnfamily , get 100 records in batch everytime ,
> till all keys are exhausted.
>
> I am using random partitioner for keyspace. I explored  limit option in
> cql and ,setMaxresults() , but It doesnt give me ability to do range scan
> over row keys .
>
> One option I can think of is Storing those row keys in separate column
> family as columns and do range queries on column.
>
> Is there any best practice to achieve this ?
>
> Any help ?
>
>
> Thanks,
> Snehal
>
>
>

Re: Pagination over row Keys in Cassandra using Kundera/CQL queries

Posted by aaron morton <aa...@thelastpickle.com>.
Try this http://wiki.apache.org/cassandra/FAQ#iter_world

Take a look at the code examples it points to. 

Cheers

-----------------
Aaron Morton
Freelance Cassandra Developer
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 10/01/2013, at 11:55 AM, Snehal Nagmote <na...@gmail.com> wrote:

> Hello All,
> 
> I am using Kundera 2.0.7 and Cassandra 1.0.8. I need to implement batching/ pagination over row keys.  
> 
> for instance, Scan columnfamily , get 100 records in batch everytime , till all keys are exhausted.
> 
> I am using random partitioner for keyspace. I explored  limit option in cql and ,setMaxresults() , but It doesnt give me ability to do range scan over row keys . 
> 
> One option I can think of is Storing those row keys in separate column family as columns and do range queries on column.
> 
> Is there any best practice to achieve this ?
> 
> Any help ?
> 
> 
> Thanks,
> Snehal
> 


Pagination over row Keys in Cassandra using Kundera/CQL queries

Posted by Snehal Nagmote <na...@gmail.com>.
Hello All,

I am using Kundera 2.0.7 and Cassandra 1.0.8. I need to implement batching/
pagination over row keys.

for instance, Scan columnfamily , get 100 records in batch everytime , till
all keys are exhausted.

I am using random partitioner for keyspace. I explored  limit option in cql
and ,setMaxresults() , but It doesnt give me ability to do range scan over
row keys .

One option I can think of is Storing those row keys in separate column
family as columns and do range queries on column.

Is there any best practice to achieve this ?

Any help ?


Thanks,
Snehal