If the database we use doesn't have counter type, is it possible to just use integer type instead? I see on your explanation that counter type is just an alias for integer type, right? Does it affect the performance of our application if we use integer type instead?
If you're using a classic rdbms like postgres/MySQL/mssql then yes. There should be an atomic update to increment/decrement. Of course index on the likes table should work for count(postid) as well ..
Cassandra and ScyllaDB have differing behaviors for the benefit of horizontal scaling.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
If the database we use doesn't have counter type, is it possible to just use integer type instead? I see on your explanation that counter type is just an alias for integer type, right? Does it affect the performance of our application if we use integer type instead?
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.
If you're using a classic rdbms like postgres/MySQL/mssql then yes. There should be an atomic update to increment/decrement. Of course index on the likes table should work for count(postid) as well ..
Cassandra and ScyllaDB have differing behaviors for the benefit of horizontal scaling.