Do all views reindex when updating a design doc?


#1

If I have multiple views in a design document and I modify only one view will couchbase reindex all the views or will it notice that most are unchanged and only reindex the one that changed?

Thanks

P


#2

Only the one that changed.


#3

I’d hoped it would

Thanks Jens


#4

@jens can I ask you one more thing?

In the documentation it says that design documents created through SG use rev like normal docs, however you can update an existing design doc without providing a rev, and a GET on the design doc does not provide the rev either, just the “views”.

Is there another call I’m missing to access the rev? Do they actually have a rev at all, as they don’t seem to be backed by actual documents?

Thanks

P


#5

The design doc calls in the SG REST API are mostly just passed through to Couchbase Server. I’m not sure how Server stores design docs, but they don’t manifest as documents in the bucket, and they don’t have revision IDs.


#6

I guessed it was something like that, and that the documentation isn’t quite right.

Thanks again

P


#7

@paulharter Can you share a link to the particular documentation you’re referring to (that suggests that design docs use rev) so that we can get it cleaned up?


#8

@adamf in the 1.3 documentation

https://developer.couchbase.com/documentation/mobile/1.3/references/sync-gateway/admin-rest-api/index.html#!/query/get_db_design_ddoc


#9

I know this is an old thread but I wanted to know the same thing. @jens said “Only the one that changed” will be updated. In the documentation, here it says:

“Because the index for each map/reduce combination within each view within a given design document is updated at the same time, avoid declaring too many views within the same design document. For example, if you have a design document with five different views, all five views will be updated simultaneously, even if only one of the views is accessed.

This contradicts Jens reply, possibly because Jens was specifically referring to SG. I’m not using SG for my bucket, so I’d like to check the correct behaviour.

The reason why I’m asking is that currently when a doc is added to the bucket, I want all the views updated in a design doc so I run a query on each view in turn to update (with limit=0 and stale=false). Do I need to do this or would it work if I ran a query on only one view in the ddoc?