5

Are there potential performance penalties for using the skip parameter in indexes in Cloudant or CouchDB? Is there a better technique to use?

1 Answers1

4

The Writing and Querying MapReduce Views in CouchDB has a great example and description for using the skip parameter:

The skip parameter can be used along with the limit parameter to implement pagination. However, skipping a large number of rows can be inefficient. Instead, set the skip parameter’s value to 1 and use the key of the last row on the previous page as the startkey (endkey if output is reversed) parameter, and the document ID of the last row on the previous page as the startkey_docid (endkey_docid if output is reversed) parameter. This should give you better performance since CouchDB will not need to scan the entire range of skipped rows."

There is also similar info in Scaling CouchDB

garbados
  • 885
  • 5
  • 21
  • There has been improvements since `v1.2` https://issues.apache.org/jira/browse/COUCHDB-1076 which also as caused updates to the docs `v1.6` http://couchdb.readthedocs.org/en/latest/couchapp/views/pagination.html BUT is it enough? Did a write up about it here: http://danielwertheim.se/2014/04/01/couchdb-pagination-is-skip-and-limit-enough/ – Daniel Apr 02 '14 at 08:58