couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <>
Subject Re: Which view is better optimized ?
Date Tue, 22 Jul 2014 15:44:13 GMT

On Jul 22, 2014, at 2:51 AM, Landry Soules <> wrote:

> My question is : is it more efficient to create a single view containing
> several emit, for example:
> emit([doc.age, doc.gender, doc.lastSeen], doc);
> emit([doc.gender, doc.age, doc.lastSeen], doc);
> or to create several views, each of them containing one emit statement ?

Creating several views is probably better, since each one will be slightly faster to search.
Also, with one view you can easily get mixed up between different types of keys — for example,
if you emit both doc.gender and as keys, and both are strings, then the “F” gender
rows are going to appear in between the names that start with “E” and “F”, which sounds
like a mess.

View raw message