Comment 7 for bug 541637

Revision history for this message
Stuart Bishop (stub) wrote : Re: [Bug 541637] Re: Mutated items in launchpadlib search results iterator can break iteration

On Tue, Mar 23, 2010 at 4:10 AM, Martin Pool <email address hidden> wrote:
> I think I would like the client to say "get me the first 50 bugs in
> order by bug number" then "get me the next 50 with id >
> previous_result[-1].id" and so on up.  That should be stable: I might
> miss new things inserted into ranges I've already seen but that's
> entirely reasonable.

This is a good approach when results are ordered by a unique, unchangeable key. It is also more efficient at the database end (as 'WHERE id > x ORDER BY id LIMIT y' is faster than 'ORDER BY id OFFSET z LIMIT y' when you get to higher offsets).

I wonder if we could special case things when results are ordered by id?

Materializing the resultset on the server and reusing it for multiple client requests can be problematic, for example materializing several million rows of results but only ever retrieving the first 50 is very inefficient.

--
Stuart Bishop <email address hidden>
http://www.stuartbishop.net/