English 中文(简体)
CouchDB View, Map, Index, and Sequence
原标题:

I think read somewhere that when a View is requested the "map" is only run across documents that have been added since the last time it was requested? How is this determined? I thought I saw something about a sequence number. Is this something that you can get to? Its not part of the UUID trailing on the _rev field is it?

Any way to force a recalc of the entire View (across all records)?

最佳回答

The section about View Indexes in the Technical Overview is a great guide to this.

The view builder uses the database sequence ID to determine if the view group is fully up-to-date with the database. If not, the view engine examines the all database documents (in packed sequential order) changed since the last refresh. Documents are read in the order they occur in the disk file, reducing the frequency and cost of disk head seeks.
As documents are examined, their previous row values are removed from the view indexes, if they exist. If the document is selected by a view function, the function results are inserted into the view as a new row.

CouchDB first checks to see if anything has changed in the entire database using a sequence id (that gets updated whenever there s a change to any document in the database). If something has changed it goes looking for those documents and runs the map function on them.

There really shouldn t be any need to rebuild/regenerate your views since it will incrementally refresh as you modify your documents (note that it won t update the view until you use it though). With hat said one way (and I m sure there s a better way) would be to remove the design document describing the view and insert it again seeing as a design document is no different (almost) from a normal document.

问题回答

暂无回答




相关问题
adding an index to sql server

I have a query that gets run often. its a dynmaic sql query because the sort by changes. SELECT userID, ROW_NUMBER(OVER created) as rownumber from users where divisionID = @divisionID and ...

Linq to SQL nvarchar problem

I have discovered a huge performance problem in Linq to SQL. When selecting from a table using strings, the parameters passed to sql server are always nvarchar, even when the sql table is a varchar. ...

TableView oval button for Index/counts

Can someone help me create an index/count button for a UITableView, like this one? iTunes http://img.skitch.com/20091107-nwyci84114dxg76wshqwgtauwn.preview.jpg Is there an Apple example, or other ...

Move or copy an entity to another kind

Is there a way to move an entity to another kind in appengine. Say you have a kind defines, and you want to keep a record of deleted entities of that kind. But you want to separate the storage of ...

热门标签