databasecouchdbcouchdb-futon

couchdb keeps growing (filesize)


I'm very confused about the CouchDB behaviour in terms of database file-size on disk. It seems like it doesn't matter what I do, the database-file only gets bigger and bigger (even on deleting/purging documents or whole databases).

I watched my /var/lib/couchdb/_dbs.couch file and it never decreased in size ever. Simple example:

curl -X PUT http://admin:secretpassword@localhost:5984/testdb

_dbs.couch increased filesize by 5kb.

curl -X DELETE http://admin:secretpassword@localhost:5984/testdb

No changes in filesize. Even if I do filtered replications of Databases (filtering out deleted documents) or manually trigger a compaction, the disk file-size does not decrease. What's really confusing now is, that Fauxton actually shows reduced databases sizes after those actions, but it never reflects in the physical diskspace used.

I'm using pretty much a standard configuration after a fresh installation.

Is this "working like intended" or is there anything wrong here?

More importantly: Is there anything I can do about it?


Solution

  • It's working as intended, you're just not looking at the right files.

    Each database has corresponding files with the same name.

    For example with:

    curl -X PUT http://admin:secretpassword@localhost:5984/testdb

    curl -X PUT http://admin:secretpassword@localhost:5984/emaildb

    data/ +-- shards/ | +-- 00000000-7fffffff/ | | -- emaildb.124456678.couch | | -- testdb.647948447.couch | +-- 80000000-ffffffff/ | | -- emaildb.124456678.couch |___|____-- testdb.647948447.couch

    More infos: http://docs.couchdb.org/en/latest/cluster/sharding.html