incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <>
Subject Re: counting rows in range queries
Date Thu, 30 Jul 2009 07:15:52 GMT
On Thu, Jul 30, 2009 at 2:53 AM, Fabio Forno<> wrote:
> On Thu, Jul 30, 2009 at 3:22 AM, Paul Davis<> wrote:
>> My bad, that should read 'emit([doc.bucket,], value)'
> Well but it doesn't work either, since when I retrieve the view I get
> as many rows as the selected docs, with count 1. Perhaps my
> description was confusing, since date is not something like YYMMDD,
> but YYMMDDhhmmss. Therefore all the emitted keys are different and the
> reduce function can't do any aggregation.

This doesn't matter at all.

> This seems to me the case in which the returned total_rows should be
> not the number of docs in the view, but instead the actual number of
> selected documents. I know that there is a big penalty, however it is
> more efficient to let couchdb do it (if the btree implementation is is
> good, walking though keys shouldn't be so slow, since consecutive keys
> are in the same disk pages) than retrieving everything through the
> network. So why not adding a parameter to the view GET for telling
> couchdb if it has to count all the documents or not?

Total rows always reflects the number of rows in the view. It can
cause some confusion, but the other way around I don't know that it'd
cause any less.

Also, are you checking the value of the assumed single return row? If
you're not getting a single returned row then something is wrong. If
you are and it's wrong, then its wrong or I'm wrong. Either way, I'm


> --
> Fabio Forno, Ph.D.
> Bluendo srl
> jabber id:

View raw message