couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <>
Subject Re: Slooooow views
Date Wed, 07 Jan 2009 23:08:24 GMT
On Wed, Jan 7, 2009 at 2:49 PM, Chris Van Pelt <> wrote:
> A request to one of my views after it is fully updated takes 2-4
> seconds.  The view is rather complex, using compound keys and an
> involved reduce step, but I assumed that didn't matter once the update
> step was complete.  I have 10000 documents in my DB.
> The update step, after adding 11 documents, takes 23 seconds.

2 seconds per document sounds like rather a lot. If you could post
your view and example document that might help us find the problem.

> I've also been looking for a way to edit my views without taking down
> my entire site for the 15 minutes it takes to regenerate the entire
> index.  It seems plausible to keep the old index around for queries
> while the new index is being created, no?

I think this is till an open question... the answer will be to leave
the old design doc alone, while generating the new one under a new
name. The more interesting part is how to upgrade users to newer
versions of your application.

In the simplest case for this, "users" are your app-servers, in which
case you can just change the query running code to query the new
design doc. If you push the new design doc to production, and kick off
view generation, but wait until generation is complete to deploy new
application code, you should avoid slow end-user performance.
CouchRest (my Ruby adapter) handles this by naming design docs after a
hash of their contents. This way you never end up overwriting one, and
new code talks to new design docs automatically.

It's a little harder to manage the upgrades for Ajax apps that are
querying your views directly from the browser. In this case you
probably don't want at least the static HTML pages urls to change. If
they are contained in design docs themselves, then you've at least got
to change the html and javascript attachments on the old design doc,
to point to the views in the new design doc. But you don't want to
make that change until after the views have generated.

So you can see it's possible, but not very pretty. I think we should
world to make the upgrade path here a little simpler.

Chris Anderson

View raw message