couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brad King" <>
Subject Re: Compaction of new database
Date Mon, 07 Jul 2008 20:48:14 GMT
I can buy that. 5x reduction the compacted data size was just not
something I expected to see on a new db. Thanks.

> On Mon, Jul 7, 2008 at 4:08 PM, Damien Katz <> wrote:
> On Jul 7, 2008, at 2:56 PM, Jan Lehnardt wrote:
>> On Jul 7, 2008, at 20:38, Brad King wrote:
>>> Maybe I don't understand compaction, but based on what I've read this
>>> is meant to get rid of old doc versions, and essentially any
>>> fragmentation that has occurred. What I'm seeing is for a brand new
>>> database, I create approximately 300K documents and the size is 2.2GB.
>>> I then run a compact from Futon, and size drops to 414MB. Since this
>>> is a new database, which should only have one version of each
>>> document, why the dramatic size change?
>> CouchDB trades disk space for read and write-speed as well. Not only
>> for consistency and having old revisions around. When you bulk insert
>> all docs, or a bunch of docs at a time, you see less usage than when
>> you do single inserts.
> Correct. The wasted disk space are small bits of the internal indexes, each
> time you update the database there will be old index data taking up space.
> The amount of space wasted is a function (O(log n)) of the total number of
> documents in the database, regardless if its one document being saved, or
> 1000. Using bulk insert helps reduce the wasted space. And compaction will
> eliminate it completely.
> -Damien
>> Cheers
>> Jan
>> --

View raw message