5

Can someone please explain the difference between INT and VARINT data types in Cassandra. When should I use VARINT and what are its advantages ?

jq170727
  • 13,159
  • 3
  • 46
  • 56
Ligo George
  • 819
  • 2
  • 9
  • 21

2 Answers2

5

As mentioned in the answer

and described in the Cassandra documentation, int is a 32-bit integer whereas varint is an arbitrary-precision integer implemented by java.math.BigInteger. As such int will be smaller and faster compared to varint but limited in its range.

java.math.BigInteger has been discussed previously in these stack overflow questions:

jq170727
  • 13,159
  • 3
  • 46
  • 56
-3

int is final.... varint is not. Like static in C/C++/java