add batch view method for faster pagination #156
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
'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