Skip to content

run automatic compaction on db shards

h2. Compaction:

Couch will not clear unused data unless you compact it. Here's a sample session on clam:

root@clam:/opt/bigcouch/var/lib/shards/e0000000-ffffffff# ls -lahS
-rw-r--r--  1 bigcouch bigcouch  372M Jan 25 18:55 user-847a6ece58ce498e4cd86cb10a6e9f98.1388235416.couch
...

curl -X POST --netrc-file /etc/couchdb/couchdb.netrc "http://127.0.0.1:5986/shards%2Fe0000000-ffffffff%2Fuser-847a6ece58ce498e4cd86cb10a6e9f98.1388235416/_compact" -H "Content-Type: application/json"

root@clam:/opt/bigcouch/var/lib/shards/e0000000-ffffffff# ls -lahS
-rw-r--r--  1 bigcouch bigcouch  158M Jan 27 19:19 user-847a6ece58ce498e4cd86cb10a6e9f98.1388235416.couch
...

So we went down from 372 to 158 MB - would sure be interesting to see how this goes for the 2.4 GB you mentioned earlier.

I think we should run compaction on all databases on a regular basis.

Generic info about compaction: https://wiki.apache.org/couchdb/Compaction

Compaction on bigcouch: https://github.com/cloudant/bigcouch/issues/43

from http://bigcouch.cloudant.com/api: "DB and view index _compact resources are not supported. Compaction is triggered for each database partition individually via the backdoor HTTP interface."

(from redmine: created on 2014-01-28, closed on 2014-03-13, duplicates #4798 (closed))