VARINT is an integer type for values that may exceed BIGINT’s fixed 64-bit range. It can grow to represent arbitrarily large numeric values, although such requirements are uncommon. section 4.2.2
Choose VARINT by considering both current and future numeric bounds:
- Use it when values may exceed BIGINT’s maximum of 9,223,372,036,854,775,807. section 4.2.2
- Prefer a smaller integer type when its range fits, because oversized numeric types waste database space. section 4.2.2
- Do not use VARINT merely for an ordinary review score; a 1-to-100 TINYINT representation fits that requirement. section 4.2.2
Table 4.4 The four integer types in CQL
|
Type
|
Size
|
Minimum value
|
Maximum value
|
|---|---|---|---|
TINYINT
|
8-bit
|
-128
|
127
|
SMALLINT
|
16-bit
|
-32,768
|
32,767
|
INT
|
32-bit
|
-2,147,483,648
|
2,147,483,647
|
BIGINT
|
64-bit
|
-9,223,372,036,854,775,808
|
9,223,372,036,854,775,807
|
Compare VARINT’s unbounded capacity with the fixed ranges of TINYINT, SMALLINT, INT, and BIGINT. section 4.2.2
