couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "HTTP view API" by MarkHammond
Date Mon, 06 Jul 2009 00:51:45 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The following page has been changed by MarkHammond:
http://wiki.apache.org/couchdb/HTTP_view_API

The comment on the change is:
clarify when stale=ok can use an existing index reference

------------------------------------------------------------------------------
  
  The ''skip'' option should only be used with small values, as skipping a large range of
documents this way is inefficient (it scans the index from the startkey and then skips N elements,
but still needs to read all the index values to do that). For efficient paging use ''startkey''
and/or ''startkey_docid''.
  
- The ''stale'' option can be used for higher performance at the cost of possibly not seeing
the all latest data. If you set the ''stale'' option to ''ok'', CouchDB may not perform any
refreshing on the view that may be necessary. Using this option essentially tells CouchDB
that if a reference to the view index is available in memory, go ahead and use it, even if
it may be out of date. The result is that for a highly trafficked view, end users can see
lower latency, although they may not get the latest data. However, if there is no view index
pointer in memory, the behavior with this option is that same as the behavior without the
option. If your application use ''stale=ok'' for end-user queries, you'll need either a cron
or a notification process like the one described in ["Regenerating views on update"], which
queries without ''stale=ok'' to ensure that the view is kept reasonably up to date.
+ The ''stale'' option can be used for higher performance at the cost of possibly not seeing
the all latest data. If you set the ''stale'' option to ''ok'', CouchDB may not perform any
refreshing on the view that may be necessary. Using this option essentially tells CouchDB
that if a reference to the view index is available in memory (ie, if the view has been queried
at least once since couch was started), go ahead and use it, even if it may be out of date.
The result is that for a highly trafficked view, end users can see lower latency, although
they may not get the latest data. However, if there is no view index pointer in memory, the
behavior with this option is that same as the behavior without the option. If your application
use ''stale=ok'' for end-user queries, you'll need either a cron or a notification process
like the one described in ["Regenerating views on update"], which queries without ''stale=ok''
to ensure that the view is kept reasonably up to date.
  
  View rows are sorted by the key; specifying ''descending=true'' will reverse their order.
Note that the ''descending'' option is applied before any key filtering, so you may need to
swap the values of the ''startkey'' and ''endkey'' options to get the expected results. The
sorting itself is described in ViewCollation.
  

Mime
View raw message