0

If I need to get CouchDB to either create or recreate a large view index, is it enough to just pass in the view path in the URL with the '?limit=1', so that it doesn't send back all the data? Or will that only build the index for the first record? I other words, does CouchDB always build the entire index no matter wat the query was?

1 Answer 1

3

The first time you query a CouchDB view, the entire view index will be generated, no matter what your query is. (source: documentation) Even if you specify limit=1, there is no possible way that CouchDB will know what item comes first in the list until the entire index is updated.

Once your view index is generated though, it doesn't need to be rebuilt again as it will only be updated incrementally from that point forward. If you're worried about your first user paying a penalty for querying a view, or if you have a very large database, you can always query the view yourself in order to kick things off on your own timeframe.

If you're new to CouchDB views, I would highly encourage reading their guide to views.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, Dominic. That's exactly what I wanted to know. When I said about recreating a view index, I meant the situation where the code for the view changes. And yes, I was wanting to know this because of the response time penalty for the first user, which I wanted to avoid.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.