couchrest/couchrest_model — pull request #156 by jhecking (2012-10-06 19:23:10+00:00)
Title: add batch view method for faster pagination

'Fast Paging', a.k.a. Batch Loading

Pagination using just skip and limit can be very slow as CouchDB
still needs to read all the rows of the view that it skips. That's
why the CouchDB team recommends to use the skip parameter only with
"single digit values." The batch method follows the 'Fast Paging'
recipe [1] for using startkey(_docid) for faster pagination.

Note that 'Fast Paging' does not allow jumping directly to a specific
page within the results. If that is required the page method should
be used instead.

Use of the batch method is recommended esp. for use cases where it is
necessary to load all the documents in a view for processing but
loading them all at once is undesirable, e.g. due to memory
constraints.

[1] http://guide.couchdb.org/draft/recipes.html#pagination