I converted this over to a feature request, I can give some use cases for this.
-
A voting system that needs to add one transactionally without record of who casts the vote
-
A simplistic social media use case where a post can have likes but liking users are not tracked, really just a deviant of the above.
-
A counter for IoT tool that tracks persons/things in and out. There are door greeters at stores counting heads in and out and an application in that manner would need to always be accurate between multiple doors. This is probably the most real use case atm.
- There are 5 people in the store the greeters at the three doors and two customers
- A person enters door A
- A person enters door B
- A person exits door C
- Door A greeter gets current count (5)
- Door B greeter gets current count (5)
- Door C greeter gets current count (5)
- Door A greeter adds one and sets count (6)
- Door B greeter adds one and sets count (6)
- Door C greeter subtracts one and sets count (4)
- The count shows 4 but there are actually 6 heads.
References to support request:
In a single MySQL query, you can increment a value with
UPDATE store_counts
SET heads = heads + 1
WHERE store_id = ?