Super column family
Encyclopedia
A super column family is a NoSQL object that contains column families. It is a tuple
Tuple
In mathematics and computer science, a tuple is an ordered list of elements. In set theory, an n-tuple is a sequence of n elements, where n is a positive integer. There is also one 0-tuple, an empty sequence. An n-tuple is defined inductively using the construction of an ordered pair...

 (pair) that consists of a key-value pair, where the key is mapped to a value that are column families. In analogy with relational databases, a super column family is something like a "view" on a number of tables. It can also be seen as a map of tables.

Benefits

It is useful when making a data model to have some kind of a view
View (database)
In database theory, a view consists of a stored query accessible as a virtual table in a relational database or a set of documents in a document-oriented database composed of the result set of a query or map and reduce functions...

 on a number of tables
Table (database)
In relational databases and flat file databases, a table is a set of data elements that is organized using a model of vertical columns and horizontal rows. A table has a specified number of columns, but can have any number of rows...

. Using a super column family is something similar to that in distributed data store
Distributed data store
A distributed data store is a blurred concept and means either a distributed database where users store their information on a number of nodes, or a network in which a user stores their information on a number of peer network nodes ....

s. There are, however, no "joins" between the "tables", as data stores like Apache Cassandra are non-relational.

Sorting and querying

There is no way to sort super columns after they have been inserted, nor to query
Query language
Query languages are computer languages used to make queries into databases and information systems.Broadly, query languages can be classified according to whether they are database query languages or information retrieval query languages...

 an arbitrary query in distributed data store
Distributed data store
A distributed data store is a blurred concept and means either a distributed database where users store their information on a number of nodes, or a network in which a user stores their information on a number of peer network nodes ....

s. Super columns are sorted when they are added to the column family, and it is also possible to use a different sorting attribute for the contained columns
Column (data store)
A column of a distributed data store is a NoSQL object of the lowest level in a keyspace. It is a tuple consisting of three elements:* Unique name: Used to reference the column* Value: The content of the column...

 of a super column. Similar to the standard column family
Standard column family
The standard column family is a NoSQL object that contains columns of related data. It is a tuple that consists of a key-value pair, where the key is mapped to a value that is a set of columns. In analogy with relational databases, a standard column family is as a "table", each key-value pair...

, sorting is defined by an attribute. This attribute is called the CompareSubcolumnsWith in Apache Cassandra and have the following values:
  • AsciiType
  • BytesType
  • LexicalUUIDType
  • LongType
  • TimeUUIDType
  • UTF8Type


Although it is possible to sort the super columns in a way, the columns inside the super columns another way, it is not allowed to treat part of the super columns in a special way.

Super column families vs. views

Column families have a schemeless nature so that each of their "row"s can contain a different number of columns, and even different column names could be in each row. So, they are a very different concept than the rows in relational database management system (RDBMS)
Relational database management system
A relational database management system is a database management system that is based on the relational model as introduced by E. F. Codd. Most popular databases currently in use are based on the relational database model....

s. This is one of the reasons why the concept is not trivial for an experienced RDBMS expert.

Code example

Here is an example of a super column family that contains other column families:


UserList={
Cath:{
username:{firstname:”Cath”,lastname:”Yoon”}
address:{city:”Seoul”,postcode:”1234”}
}
Terry:{
username:{firstname:”Terry”,lastname:”Cho”}
account:{bank:”hana”,accounted:”1234”}
}
}

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK