openstack team mailing list archive
-
openstack team
-
Mailing list archive
-
Message #02575
Re: Getting pagination right
On Wed, May 25, 2011 at 2:40 PM, Jay Pipes <jaypipes@xxxxxxxxx> wrote:
> The pagination in Swift is not consistent. Inserts into the Swift
> databases in between the time of the initial query and the requesting
> the "next page" can result in rows from the original first page
> getting on the new second page.
No, you only get records not on the first page, because you're sending
a marker of the last item from the first page. Though even if that
were the case, I wouldn't do very much work to try and provide some
sort of point-in-time consistent view of the database for pagination.
> On Wed, May 25, 2011 at 3:32 PM, Greg Holt <gholt@xxxxxxxxxxxxx> wrote:
>> select w from x where y > marker order by y limit z
> LIMIT X OFFSET Y clause. Your query above would return ALL the rows
> that match WHERE y > marker. That's not what we want. We want a
> segment of those rows.
He had a limit clause in there.
The reason we usually shy from offsets is they don't scale. I don't
know what cardinality you're expecting on these tables, but if you're
querying for an offset of a million, offset's gotta go count a million
records before it can return any results. For a marker query, it can
just do an index lookup.
-- Mike
Follow ups
References