Databases Reference
In-Depth Information
FIGURE 4.23
Key-value pair.
FIGURE 4.24
Cassandra key-value pair (column).
Low cost of ownership
Minimal administration
Data model
The Cassandra data model is based on a key-value model, where we have a key that uniquely identi-
fies a value, and this value can be structured or completely unstructured or can also be a collection
of other key-value elements. This is very similar to pointers and linked lists in the world of program-
ming. Figure 4.23 shows the basic key-value structure.
A key-value pair can represent a simple storage for Person →→Name type of data but cannot
scale much. An alteration to the basic model is done to create a name and value in the key-value pair,
and this would provide a structure to create multiple values and associate a key to the name-value
pair. This creates a tablelike structure described in Figure 4.24 .
In the updated structure of the key-value notation, we can store Person → Name → John Doe, add
another column called Person → Age → 30, and create multiple storage structures. This defines the
most basic structure in the Cassandra data model called column.
Column. A column is an ordered list of values stored as a name-value pair. It is composed of a
column name, a column value, and a third element called timestamp. The timestamp is used to
manage conflict resolution on the server, when there is a conflicting list of values or columns to
be managed. The client sets the timestamp that is stored along with the data, and this is an explicit
operation.
The column can hold any type of data in this model, varying from characters to Globally Unique
Identifiers (GUID) to blobs. Columns can be grouped into a row called a rowkey. A simple
column by itself limits the values you can represent; to add more flexibility, a group of columns
belonging to a key can be stored together, called a column family. A column family can be loosely
compared to a table in the database comparison.
Column family. A column family is a logical and physical grouping of a set of columns that can
be represented by a single key. The flexibility of a column family is the names of columns can
vary from a row to another and the number of columns can vary over a period of time. Figure 4.25
shows a sample column family.
There is no limitation with creating different column structures in a column family, except the
maintenance of the same is dependent on the application that is creating the different structures.
Conceptually, it is similar to overloading in the object-oriented programming language.
 
Search WWH ::




Custom Search