The two are quite different.
getAndTouch) prevent a document from being automatically deleted because of its expiry, by renewing the TTL of the document. Also, the documents that expire are not necessarily removed immediately when they expire, but rather by a regular expiry pager scheduled process. See the docs for more info on expiry.
remove directly removes a document from the database, but that is an active operation (you need to call it and know which key to delete).
touch also cause fragmentation
Both cause “fragmentation” in the sense that Couchbase will keep a “tombstone” metadata to mark the deletion of a key, so that it can replicate the deletion to all the nodes. The storage format is append only, so it also keeps the deleted document on disk. But once compaction kicks in, these deleted documents will be removed and after a while these tombstones will be removed as well.
For such an application would you suggest touch() or remove().
Overall, I’d say if you have a good way of identify which documents need to be deleted, go for
If there is a large number of deletions to be performed, and a short number of documents whose life needs to be “extended”, use TTL and
touch on these extended life documents.
But it highly depends on your application needs and workload, so don’t hesitate to measure and plan for a switch in strategy later on.