I wish to use a simple increment and decrement for my dynamoDB table.
The update looks something like:
aws dynamodb update-item \
--table-name table_name \
--key 'le key' \
--update-expression "ADD #C :delta" \
--expression-attribute-names '{"#C": "count"}' \
--expression-attribute-values '{":delta":{"N":"1"}}' \
--return-values UPDATED_NEW
For increment delta
would be 1, for decrement it would be -1.
In concurrent workloads and race condition possibilities, how consistent would such updates be if we have multiple increments and decrements occurring together?
I hope it would be pretty consistent, considering we are NOT "getting and setting" the values, but directly passing the delta
to be added. This is the reason I've added this as a separate question and don't consider it a duplicate of questions like these where people often suggest conditional updates.