Which is faster

Hi All,

Please advice on below,
What is fastest way to DELETE document from BUCKET.SCOPE.COLLECTION

  1. bucket.scope(this.scope).query(query);
    query = “DELETE FROM COLLECTION WHERE payload.ID = $ID$”

  2. cluster.query(cbStatement);

Hi @bphalak
I’d expect those to run at pretty much the same execution time, but perhaps my colleagues in the N1QL team can advise better there.
Can you structure your data so you have the document id available in your app? You could then use a Key-Value remove instead, which will be slightly faster than a query as the request can go directly from the SDK to the key-value node that’s the active for that document, plus there is no query parsing required.

1 Like

Within the query service, they would be the same.