← Back to team overview

openstack team mailing list archive

Re: Getting pagination right


select w from x where y > marker order by y limit z

This gives you consistent pagination, means the database doesn't have to count matching rows to find an offset, and means you could shard by y later in life if you need to scale that much.

On May 25, 2011, at 2:28 PM, Jay Pipes wrote:

> On Wed, May 25, 2011 at 3:10 PM, Greg Holt <gholt@xxxxxxxxxxxxx> wrote:
>> Okay cool. Just stop using the term offset anywhere in your examples then and drop the whole page= thing as well. :)
> Sorry, I'm not understanding what you're getting at here. The offset
> is required to pass to the database query as the OFFSET clause. The
> page= parameter allows you to calculate that OFFSET value.
> -jay

Follow ups