couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J Chris Anderson <>
Subject Re: Pagination and 'pretty' urls
Date Tue, 23 Mar 2010 16:35:59 GMT

On Mar 23, 2010, at 7:07 AM, Kevin Jackson wrote:
> The problem is that we would
> like to have urls of the form page=1, page=2 etc and at the moment we
> have page?start=[]&end=[]. 

There's a deep problem with trying to do page=N style pagination. It is possible but you have
to do extra reduce queries to support it.

Because unless you know what the startkey is of page=N, you can't query for it. If you are
willing to do natural keys, this is simplified, as instead of pages you can do Jan, Feb, March,
April, etc.

The other option is to do a binary search with reduce queries, to approximately find the startkey
of the Nth row. There's a lot of overhead here, and you can get weird symptoms. 

Have you ever tried browsing backwards through flickr's  recent uploads feed? If you aren't
fast enough, people upload faster than you can browse, and you see the same photos over and
over again. If they used linked-list or natural key style pagination, this wouldn't be an


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message