Sunday, 25 January 2015

Collections in Cassandra

The type of data stored in each of these collections requires to be defined. Only native data types can be used in collections.Cassandra reads a collection in its entirety and the collection is not paged internally. The maximum number of items of a collection is 64K and the maximum size of an item is 64K.

1. Set

Internally, Cassandra stores each element of the set as a single column whose column name is the original column name suffixed by a colon and the element value. 
By the built-in order column-name-nature of Cassandra, the elements of a set are sorted automatically.

2. List
In contrast to a set, the input order of a list is preserved by Cassandra. Cassandra also stores each element of the list as a column. But this time, the columns have the same name composed of the original column name a colon, and a UUID generated at the time of update. The element value of the list is stored in the value of the column.

3. Map
Each key/value pair is stored in a column whose column name is composed of the original map column name followed by a colon and the key of that pair. The value of the pair is stored in the value of the column. Similar to a set, the map sorts its items automatically. As a result, a map can be imagined as a hybrid of a set and a list.

No comments:

Post a Comment