DEV Community

Discussion on: Database 101: How social media “likes” are stored in a database

Collapse
 
danielhe4rt profile image
Daniel Reis ScyllaDB

The idea behind the counter is to use always increment and decrement operation, eg: item + 1 || item - 1

Since it will not depend on which number stopped on the last row, you can deal easily with concurrent connections without loss any data.