Which view is better optimized ?

2014-07-22 Thread Landry Soules
Hello, I have a simple users document containing fields such as gender, age and last seen date. I have to request these documents by age, or gender, or last seen date or a mix of these criteria. My question is : is it more efficient to create a single view containing several emit, for example:

Re: Which view is better optimized ?

2014-07-22 Thread Jens Alfke
On Jul 22, 2014, at 2:51 AM, Landry Soules landry.soules...@gmail.com 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

Re: Which view is better optimized ?

2014-07-22 Thread Mike Marino
Multiple views also allows you to split them across design documents, which means they can be built independently and in parallel. On Tue, Jul 22, 2014 at 5:44 PM, Jens Alfke j...@couchbase.com wrote: On Jul 22, 2014, at 2:51 AM, Landry Soules landry.soules...@gmail.com wrote: My question

Re: Which view is better optimized ?

2014-07-22 Thread Tito Ciuro
Is it better then to define a view per design doc then? If I have say, 8 views for a given person design doc, would you place them in one single doc or break them into smaller units? -- Tito On Jul 22, 2014, at 9:45, Mike Marino mmar...@gmail.com wrote: Multiple views also allows you to

Re: Which view is better optimized ?

2014-07-22 Thread Mike Marino
On Tue, Jul 22, 2014 at 7:02 PM, Tito Ciuro tci...@mac.com wrote: Is it better then to define a view per design doc then? If I have say, 8 views for a given person design doc, would you place them in one single doc or break them into smaller units? I think that probably heavily depends on

Re: Which view is better optimized ?

2014-07-22 Thread Sebastian Rothbucher
Hi, The smaller unit will save you lots of trouble, esp. when updating the code of large views Cheers Sebastian Von meinem iPhone gesendet Am 22.07.2014 um 19:02 schrieb Tito Ciuro tci...@mac.com: Is it better then to define a view per design doc then? If I have say, 8 views for a

Re: Which view is better optimized ?

2014-07-22 Thread Jens Alfke
On Jul 22, 2014, at 9:45 AM, Mike Marino mmar...@gmail.com wrote: Multiple views also allows you to split them across design documents, which means they can be built independently and in parallel. On the other hand, if the views are re-indexed independently, then each task is reading the

Re: Which view is better optimized ?

2014-07-22 Thread Matthieu Rakotojaona
Hello, Excerpts from Landry Soules's message of 2014-07-22 11:51:26 +0200: emit([doc.age, doc.gender, doc.lastSeen], doc); emit([doc.gender, doc.age, doc.lastSeen], doc); Unless you know what you're doing, you shouldn't emit the full doc as a value. Views are optimized that values are copied,

Re: Which view is better optimized ?

2014-07-22 Thread landry.soules.cn
Thanks a lot guys for your very useful input. And as suggested Matthieu, I will probably have a look at lucene or elasticsearch.