couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randall Leeds <>
Subject Re: CouchDB Document Size
Date Wed, 05 Jan 2011 17:29:14 GMT
I'm reminded in IRC that this is probably TMI and Robert's response is
probably sufficiently accurate, but since I just typed this up, read
on if you'd like the full exposition.


Okay. I just took another look at the code.
The database header is always written at intervals of 4KB, which means
every database *commit* will eventually result in an extension of the
database file to the next 4KB block.

If you run with delayed_commits, any writes that occur within one
second and fit within the same (4KB minus a couple dozen bytes for the
header) block should not extend the file unnecessarily. With delayed
commits turned off, writes issues by concurrent clients or using the
bulk document API will still be batched in a similar way, with a
single header written at the end.

I do not know of any work or patches that change this behavior.


On Wed, Jan 5, 2011 at 12:07, Robert Newson <> wrote:
> this is probably the header that's written to point to the new
> document (it's exactly 4k).
> 'trim' by compacting the database, this is an online operation and is
> completely safe.
> B.
> On Wed, Jan 5, 2011 at 5:01 PM, Randall Leeds <> wrote:
>> Are you sure this is the case? I would be surprised if every write
>> increased the .couch file by 4096 bytes, but totally unsurprised if
>> the only increases you see in the size of your .couch file are 4096
>> because that's probably your filesystem block size. However, many
>> small documents should fit into such a block.
>> On Wed, Jan 5, 2011 at 11:29, Chris Stockton <> wrote:
>>> Hello,
>>> I am noticing each couchdb document uses roughly 4096 bytes of data. I
>>> am curious if this number could be trimmed up at all through any kind
>>> of settings or solid/publicly available patches.
>>> -Chris

View raw message