4 Architecting IoT Cloud
201
Column family
Column family
Keyspace
c
c
c c
c
c
c
c
c
Row
c
Row
Row
Row
Row
Fig. 4.17 Keyspace and column family in Cassandra
Row key 1
Row key 2
c
c
Column 1
Value 1
Column 2
Value 2
Column 1
Value 1
Column 2
Value 2
Column 3
Value 3
Fig. 4.18 Data model in Cassandra
Table 4.3 Main differences between the relational table and Cassandra column family
Relational table
Cassandra column family
The columns are fixed and cannot be changed over time. When a
row is inserted in a table, all the pre-defined columns must have
one value and none of them can be left empty. In case a column
does not have value, it must be filled with Null value.
Columns are flexible and
can be added to the column
family whenever it is
required
Only define columns and users fill in values
Can define columns or
super column
Keyspace Cassandra Keyspace serves as the data container, with at least one
column family located in each Keyspace. Figure 4.17 provides a schematic example
of Keyspace.
Column Families Cassandra column families are collections of rows holding
ordered columns that embody the structure of housed data (see Figs. 4.16 and
4.18). Table 4.3 details the points of differentiation between a column family and a
relational database table [16, 19]:
201
Column family
Column family
Keyspace
c
c
c c
c
c
c
c
c
Row
c
Row
Row
Row
Row
Fig. 4.17 Keyspace and column family in Cassandra
Row key 1
Row key 2
c
c
Column 1
Value 1
Column 2
Value 2
Column 1
Value 1
Column 2
Value 2
Column 3
Value 3
Fig. 4.18 Data model in Cassandra
Table 4.3 Main differences between the relational table and Cassandra column family
Relational table
Cassandra column family
The columns are fixed and cannot be changed over time. When a
row is inserted in a table, all the pre-defined columns must have
one value and none of them can be left empty. In case a column
does not have value, it must be filled with Null value.
Columns are flexible and
can be added to the column
family whenever it is
required
Only define columns and users fill in values
Can define columns or
super column
Keyspace Cassandra Keyspace serves as the data container, with at least one
column family located in each Keyspace. Figure 4.17 provides a schematic example
of Keyspace.
Column Families Cassandra column families are collections of rows holding
ordered columns that embody the structure of housed data (see Figs. 4.16 and
4.18). Table 4.3 details the points of differentiation between a column family and a
relational database table [16, 19]:
