Tuesday 3 March 2020

Cassandra: counter: Define a counter

‘counter’ data type is used to define a counter, and the value is a 64-bit signed integer and on which 2 operations are supported: increment and decrement.

A counter doesn’t exist until first incremented/decremented, and the first incrementation/decrementation is made as if the previous value was 0.

Points to remember
a.   It cannot be used for column that is part of the PRIMARY KEY of a table.
b.   A table that contains a counter can only contain counters. In other words, either all the columns of a table outside the PRIMARY KEY have the counter type, or none of them have it.



Previous                                                    Next                                                    Home

No comments:

Post a Comment