How would that total be updated if something were deleted or
updated? Does
the sum() function have to be evaluated over doc.Amount of *every*
doc on
every update?
I don't grok the internals well enough to say exactly why, but I do
know that one of the main features of CouchDB is the fact that only
the changed documents (and a minimum of aggregation "re-reductions")
need to be recomputed when an already mapped doc is updated or
deleted.
But in the example I gave (that I got from the CouchDB wiki), there's
no way for the reduction to be accurate in the face of deletions and
modifications without re-calculating it for every single item in the
database. That is, given a database of 5 million rows, every time one
is modified or deleted (or possibly even added, depending on
implementation), all 5 million rows have to pass through that function
Is there another way to handle modifications and deletions?