incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guby <>
Subject Updating views on save
Date Sun, 27 Apr 2008 23:04:31 GMT
Hello dear Couchers

I understand that the views are indexed the first time they are  
accessed and as far as I know there is no way to turn on view updating  
on document save. I really don't understand the reasoning behind this  
behavior. The advantage of the pre-populated/indexed views are that  
they are blazingly fast to query and access, but that advantage  
disappears when the first request after a document update has to  
regenerate the view first!

I am currently building a web app where the background processes  
perform a lot of writes to the database. The time it takes to write a  
document is not critical for me. What is critical though is the time  
it takes to load web pages for the end user that require content from  
the database.
In some situations the background processes add thousands of documents  
to the database within a short period of time, and when the user tries  
to access a page after such an update the view querying sometimes  
takes minutes and as a consequence of that the browser times out...  
Not a recipe for happy customers...

The only solution I can see at the moment is to create a worker that  
queries the database whenever it is told that there has been a  
document update, but that seems really stupid and unnecessary. And in  
my case, running on a smallish VPS, a big waste of resources having an  
extra working doing something the database itself could just as well  
have done. It also requires a lot of extra coding notifying the worker  
whenever I update or create a document throughout my app.

I am sure you have reasons for having implemented the views the way  
you have, but I would be really interested to hear why it has been  
done this way!

My wishes are for an optional updating of views on save feature! In  
some cases that might regenerate a view several times without it  
actually being accessed in between, but that is a tradeoff I can live  
with, slow views on the other hand is something I can not!

All the best

View raw message