You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Joshua Partogi <jo...@gmail.com> on 2010/12/11 02:01:55 UTC

How do you implement pagination?

Hi all,

I am interested to see people's way to do record pagination with cassandra
because I can not find anything like MySQL LIMIT in cassandra.

>From what I understand you need to tell cassandra the Record ID for the
beginning of the slice and the number of record you want to get after that
Record. I am using UUID instead of Long for the Record ID.

My question is, how does your application get the next Record ID after the
current slice that is displayed on the page?
Let's say I want to display record 1-10, do I actually grab 11 records but
only display 10 records and only keep the ID of the 11th records so I can
use it for pagination?

Sorry if the question is a bit obscured, but I am still figuring out how to
do pagination.

Thanks very much for your assistance.

Kind regards,
Joshua.

-- 
http://twitter.com/jpartogi <http://twitter.com/scrum8>

RE: How do you implement pagination?

Posted by Dan Hendry <da...@gmail.com>.
Or you can just start at the 1 + nth id given ids must be unique (you don't
have to specify an existing id as the start of a slice). You don't HAVE to
load the n + 1 record. 

 

This (slightly) more optimal approach has the disadvantage that you don't
know with certainty when you have reached the end of all records. This may
or may not be acceptable for your application.

 

Dan

 

From: joshua.java@gmail.com [mailto:joshua.java@gmail.com] On Behalf Of
Joshua Partogi
Sent: December-10-10 21:05
To: user@cassandra.apache.org
Subject: Re: How do you implement pagination?

 

So you're actually getting n+1 record? Correct? So this is the right way to
do it?



On Sat, Dec 11, 2010 at 1:02 PM, Tyler Hobbs <ty...@riptano.com> wrote:

Yes, what you described is the correct way to do it.  Your next slice will
start with that 11th column.

- Tyler

 

On Fri, Dec 10, 2010 at 7:01 PM, Joshua Partogi <jo...@gmail.com>
wrote:

Hi all,

I am interested to see people's way to do record pagination with cassandra
because I can not find anything like MySQL LIMIT in cassandra. 

>From what I understand you need to tell cassandra the Record ID for the
beginning of the slice and the number of record you want to get after that
Record. I am using UUID instead of Long for the Record ID. 

My question is, how does your application get the next Record ID after the
current slice that is displayed on the page? 
Let's say I want to display record 1-10, do I actually grab 11 records but
only display 10 records and only keep the ID of the 11th records so I can
use it for pagination?

Sorry if the question is a bit obscured, but I am still figuring out how to
do pagination. 

Thanks very much for your assistance.

Kind regards,
Joshua.

-- 
http://twitter.com/jpartogi <http://twitter.com/scrum8> 

 




-- 
http://twitter.com/jpartogi

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.872 / Virus Database: 271.1.1/3307 - Release Date: 12/10/10
02:37:00


Re: How do you implement pagination?

Posted by Joshua Partogi <jp...@scrum8.com>.
So you're actually getting n+1 record? Correct? So this is the right way to
do it?


On Sat, Dec 11, 2010 at 1:02 PM, Tyler Hobbs <ty...@riptano.com> wrote:

> Yes, what you described is the correct way to do it.  Your next slice will
> start with that 11th column.
>
> - Tyler
>
>
> On Fri, Dec 10, 2010 at 7:01 PM, Joshua Partogi <jo...@gmail.com>wrote:
>
>> Hi all,
>>
>> I am interested to see people's way to do record pagination with cassandra
>> because I can not find anything like MySQL LIMIT in cassandra.
>>
>> From what I understand you need to tell cassandra the Record ID for the
>> beginning of the slice and the number of record you want to get after that
>> Record. I am using UUID instead of Long for the Record ID.
>>
>> My question is, how does your application get the next Record ID after the
>> current slice that is displayed on the page?
>> Let's say I want to display record 1-10, do I actually grab 11 records but
>> only display 10 records and only keep the ID of the 11th records so I can
>> use it for pagination?
>>
>> Sorry if the question is a bit obscured, but I am still figuring out how
>> to do pagination.
>>
>> Thanks very much for your assistance.
>>
>> Kind regards,
>> Joshua.
>>
>> --
>> http://twitter.com/jpartogi <http://twitter.com/scrum8>
>>
>
>


-- 
http://twitter.com/jpartogi

Re: How do you implement pagination?

Posted by Tyler Hobbs <ty...@riptano.com>.
Yes, what you described is the correct way to do it.  Your next slice will
start with that 11th column.

- Tyler

On Fri, Dec 10, 2010 at 7:01 PM, Joshua Partogi <jo...@gmail.com>wrote:

> Hi all,
>
> I am interested to see people's way to do record pagination with cassandra
> because I can not find anything like MySQL LIMIT in cassandra.
>
> From what I understand you need to tell cassandra the Record ID for the
> beginning of the slice and the number of record you want to get after that
> Record. I am using UUID instead of Long for the Record ID.
>
> My question is, how does your application get the next Record ID after the
> current slice that is displayed on the page?
> Let's say I want to display record 1-10, do I actually grab 11 records but
> only display 10 records and only keep the ID of the 11th records so I can
> use it for pagination?
>
> Sorry if the question is a bit obscured, but I am still figuring out how to
> do pagination.
>
> Thanks very much for your assistance.
>
> Kind regards,
> Joshua.
>
> --
> http://twitter.com/jpartogi <http://twitter.com/scrum8>
>