Help for optimizing


#41

Couchbase doesn’t have transaction. Its atomicity is document. It doesn’t fetch all documents then update.
it fetches documents streams and then update will happen.
When CAS mismatched documents it return error and continues.

UPDATE is done with WHERE clause , You could also UPDATE in batches with LIMIT and repeat until no more mutations.

example:
UPDATE default d SET d.c1 = “x1”, d.c2 =“x3”
WHERE (d.c1 != “x1” OR d.c2 !=“x3”) AND d.type = “doc” …
LIMIT 1000;
Above statement avoids unnecessary mutation (d.c1 != “x1” OR d.c2 !=“x3”).
If you create index that covers predicate by repeating statement you can avoid repeatable update.


#42

When CAS mismatched documents it return error and continues.

Can you explain it more?


#43

When ever document fetched from data node it retrieves CAS during update same value passed to data node. If the value is mismatched data node returns error and same error will be passed to application.