Database Reference
In-Depth Information
instrument: bass ColumnName:Value
george: RowKey
email: george@pfunk.com ColumnName:Value
Band: ColumnFamily 2
george: RowKey
pfunk: 1968-2010 ColumnName:Value
Here we have two column families, Musician and Band. The Musician column family has two
rows, “bootsy” and “george”. These two rows have a ragged set of columns associated with them:
the bootsy record has two columns (email and instrument), and the george record has only one
column. That's fine in Cassandra. The second column family is Band, and it also has a “george”
row, with a column named “pfunk”.
Columns in Cassandra actually have a third aspect: the timestamp, which records the last time
the column was updated. This is not an automatic metadata property, however; clients have to
provide the timestamp along with the value when they perform writes. You cannot query by the
timestamp; it is used purely for conflict resolution on the server side.
NOTE
Rows do not have timestamps. Only each individual column has a timestamp.
And what if we wanted to create a group of related columns, that is, add another dimension on
top of this? Cassandra allows us to do this with something called a supercolumnfamily. A super
column family can be thought of as a map of maps. The super column family is shown in Fig-
ure 3-4 .
Figure3-4.A super column family
Where a row in a column family holds a collection of name/value pairs, the super column family
holds subcolumns, where subcolumns are named groups of columns. So the address of a value
Search WWH ::




Custom Search