Database Reference
In-Depth Information
section, since we are trying to understand how the data is stored in Cassandra, we will go
the old way. Then in the next section, we will see how this maps to CQL.
At the heart of Cassandra lies two structures: column family and cell. There is a container
entity for these entities called keyspace.
Note
Previously, we used to call a cell a column. From Cassandra 1.2 onward, the nomenclature
has been changed a bit to avoid confusion with columns as defined in CQL3. Columns in
CQL3 are more in line with columns in the traditional database. "Column family" is the
old name for a table. There is still a slight difference between the column family and table,
but for the most part, we can use them interchangeably.
A cell is the smallest unit of the Cassandra data model. Cells are contained within a
column family. A cell is essentially a key-value pair. The key of a cell is called cell name
and value is called cell value . A cell can be represented as a triplet of the cell name, value,
and timestamp. The timestamp is used to resolve conflicts during read repair or to recon-
cile two writes that happen to the same cell at the same time; the one written later wins.
It's worth noting that the timestamp is client-supplied data, and since it is critical to write
a resolution, it is a good idea to have all your client application servers clock synchron-
ized. How? Read about network time protocol daemon ( NTPD ).
# A column, which is much like a relational system
{
name: "username",
value: "Carl Sagan",
timestamp: 1366048948904
}
# A column with its name as timestamp and value as
page-viewe
d
{
name: 1366049577,
value: "http://foo.com/bar/view?itemId=123&ref=email",
timestamp: 1366049578003
}
Search WWH ::




Custom Search