icy44
August 26, 2023, 1:26am
1
A job needs to delete old documents. each batch it deletes about 200 documents. we have the document ids.
which way will be more efficient:
delete by query:
delete from bucket use keys [… ids …]
bucket->query(query)
one by one:
loop through all ids and
bucket->remove(id)
thanks in advance.
vsr1
August 28, 2023, 1:49pm
2
If you know document keys use bucket->remove(id)
You can do asynchronous and parallel too.
1 Like
icy44
August 28, 2023, 4:47pm
3
Thank you @vsr1 . I assume even with Use keys
it still needs to be processed by query analyzer, but with remove(), it is just a key-value operation?
vsr1
August 28, 2023, 5:03pm
4
As long has you dont have any WHERE clause it is simple remove in loop.
If you have where clause it will do need to do fetch and remove.
NOTE: bucket.query() first need to send to to n1ql node and which need to remove from data nodes It is 2 hops operations.
1 Like
system
Closed
November 26, 2023, 5:04pm
5
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.