Cassandra Data Types

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Cassandra Data Types

Cassandra supports different types of data types. Let?s see the different data types in the following table:

CQL Type

Constants

Description

ascii

Strings

US-ascii character string

bigint

Integers

64-bit signed long

blob

blobs

Arbitrary bytes in hexadecimal

boolean

Booleans

True or False

counter

Integers

Distributed counter values 64 bit

decimal

Integers, Floats

Variable precision decimal

double

Integers, Floats

64-bit floating point

float

Integers, Floats

32-bit floating point

frozen

Tuples, collections, user defined types

stores cassandra types

inet

Strings

IP address in ipv4 or ipv6 format

int

Integers

32 bit signed integer

list

 

Collection of elements

map

 

JSON style collection of elements

set

 

Collection of elements

text

strings

UTF-8 encoded strings

timestamp

Integers, Strings

ID generated with date plus time

timeuuid

uuids

Type 1 uuid

tuple

 

A group of 2,3 fields

uuid

uuids

Standard uuid

varchar

strings

UTF-8 encoded string

varint

Integers

Arbitrary precision integer


Cassandra Automatic Data Expiration

Cassandra provides functionality by which data can be automatically expired.

During data insertion, you have to specify 'ttl' value in seconds. 'ttl' value is the time to live value for the data. After that particular amount of time, data will be automatically removed.