You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Brad Rhoads <bd...@gmail.com> on 2013/10/22 21:48:35 UTC

What's Better 1 Doc With Many Attachments or Many Docs With 1 Attachment

Hi,

>From a replication perspective especially, if I have lots, say hundreds, of
related (large) attachments, is it better to have 1 doc with many
attachments, or many docs each with 1 attachment and some field showing the
association between docs?

Thanks!

-Brad
---------------------------
www.maf.org/rhoads
www.ontherhoads.org

Re: What's Better 1 Doc With Many Attachments or Many Docs With 1 Attachment

Posted by Mark Deibert <ma...@gmail.com>.
@Adam

This is veeeery good to know. I'm doing this exact same thing. I'm
currently using one doc with hundreds of attachments, sorta like the doc is
the "folder" holding the files. I've been assuming read authorization to
this one "folder" would be simpler. I have a basic authorization solution
using a couch list and view. However, I hadn't even considered the
replication requirement which will be very important. Thanks for this tip.
I think I'll switch up.



On Tue, Oct 22, 2013 at 8:38 PM, Adam Kocoloski <ko...@apache.org> wrote:

> The initial replication of a document with a very large number of
> attachments can be expensive -- it's an all-or-nothing affair.  After that
> when you update a single attachment on the doc the replicator is smart
> enough to just transfer that attachment.
>
> Considering only the replicator's perspective I think you'll have a better
> experience by attaching each binary to a separate document.  Best,
>
> Adam
>
> On Oct 22, 2013, at 3:48 PM, Brad Rhoads <bd...@gmail.com> wrote:
>
> > Hi,
> >
> > From a replication perspective especially, if I have lots, say hundreds,
> of
> > related (large) attachments, is it better to have 1 doc with many
> > attachments, or many docs each with 1 attachment and some field showing
> the
> > association between docs?
> >
> > Thanks!
> >
> > -Brad
> > ---------------------------
> > www.maf.org/rhoads
> > www.ontherhoads.org
>
>

Re: What's Better 1 Doc With Many Attachments or Many Docs With 1 Attachment

Posted by Adam Kocoloski <ko...@apache.org>.
The initial replication of a document with a very large number of attachments can be expensive -- it's an all-or-nothing affair.  After that when you update a single attachment on the doc the replicator is smart enough to just transfer that attachment.

Considering only the replicator's perspective I think you'll have a better experience by attaching each binary to a separate document.  Best,

Adam

On Oct 22, 2013, at 3:48 PM, Brad Rhoads <bd...@gmail.com> wrote:

> Hi,
> 
> From a replication perspective especially, if I have lots, say hundreds, of
> related (large) attachments, is it better to have 1 doc with many
> attachments, or many docs each with 1 attachment and some field showing the
> association between docs?
> 
> Thanks!
> 
> -Brad
> ---------------------------
> www.maf.org/rhoads
> www.ontherhoads.org