[Openstack] Getting pagination right

Greg Holt gholt at rackspace.com
Wed May 25 19:32:32 UTC 2011


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 at rackspace.com> 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





More information about the Openstack mailing list