Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between INT and VARINT in Cassandra Datatypes?

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

like image 697
Ligo George Avatar asked Nov 07 '22 17:11

Ligo George


1 Answers

As mentioned in the answer

  • How do I store unsigned integers in Cassandra?

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:

  • What are the limits of BigDecimal and BigInteger?
  • What does BigInteger having no limit mean?
like image 151
jq170727 Avatar answered Nov 15 '22 14:11

jq170727