Krishan
Krishan

Reputation: 641

Couchdb document deletion and performance

Couchdb documents when deleted using DELETE HTTP request, doesn't actually delete the document ,instead the document still exists with "_deleted":true. This makes an update the document, so that view indexes should be updated (which I think is costly). So my question is if space is no concern, are there any performance gain that can be achieved by deleting documents

Upvotes: 1

Views: 204

Answers (1)

Hans
Hans

Reputation: 2910

I did the below test a while back. It's in a database with some pretty large documents.

I replicated the database and reran a view in a design document. Each view in this document has hundred of emits per document, with a total of around 10 million emits on the database. This took around 3 hours to generate the index file from scratch.

I ran a view in another design document that only uses the doc._id field, and has only one emit per document. This took around 3 minutes.

I then deleted all documents and ran the views again, both completed in less than 2 minutes.

Upvotes: 1

Related Questions