couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <>
Subject Re: using reduce to get SQL distinct like results
Date Wed, 27 Aug 2008 02:04:42 GMT
On Tue, Aug 26, 2008 at 6:19 PM, Joel Reed <> wrote:
> You wouldn't advise me to make multiple calls to the same view for each user
> would you? Once to get list of all users, then once for every user? I was
> thinking that maybe in this case I should be using a reduce function. What
> would you advise?

Using a reduce function shouldn't have any impact on the number of
calls you have to make. But specifically, I think a reduce function
like the one in this thread wont stand up to a very large dataset.

In your case I would have one view that outputs all the interesting
users, and then query the dates-per-user view once per each user. If
you're interested in all users, of course you can just query the whole
view all at once and avoid the N-queries problem.

In my application I routinely go the N queries route (for N of a few
hundred) and can still keep response times to within 5 or 6 seconds
(acceptable, especially with caching).

There is a patch waiting to be applied that allows for multi-key
queries, which should help (superficially) with the N queries problem.

Chris Anderson

View raw message