Markus
Markus

Reputation: 4242

Cassandra: What is a subcolumn

http://wiki.apache.org/cassandra/CassandraLimitations

Quote: Cassandra has two levels of indexes: key and column. But in super columnfamilies there is a third level of subcolumns; these are not indexed, and any request for a subcolumn deserializes all the subcolumns in that supercolumn. So you want to avoid a data model that requires large numbers of subcolumns.

=>What is exactly the subcolumn? It's interesting, googling the term does nor really yield in results. I know the concepts of supercolumn, but its not really clear what exactly the term "subcolumn" refers to (how it is defined):

What concept is correct?

First:

ROW-KEY
   SubCol     SubCol    
    col  col  col val
    val  val  col val

OR

Second:

ROW-KEY
   Column           Column
    SubCol SubCol   SubCol SubCol
    val    val      val    val

Furthermore, what is what in the Definitions:

comparator = UTF8Type and
subcomparator = UTF8Type and 

Its only a matter of definition.

Thanks Markus

Upvotes: 2

Views: 3144

Answers (2)

Henry
Henry

Reputation: 926

The comparator value indicates how columns will be sorted when they are returned to you in a query. The same concept applies to subcomparator, but for super columns.

UTF8Type refers to the Unicode standards for characters.

  • Source: "Cassandra the Definitive Guide".

Upvotes: 0

DNA
DNA

Reputation: 42597

A standard column's parent is its row. A sub-column's parent is its supercolumn. Apart from that, they are the same - there's just an additional level of nesting, though there are implications for indexing and retrieval as you've mentioned.

More info at http://wiki.apache.org/cassandra/DataModel and http://arin.me/blog/wtf-is-a-supercolumn-cassandra-data-model

Normal column family:

row
    col  col  col ...
    val  val  val ...

Super column family:

row
      supercol                      supercol                     ...
          (sub)col  (sub)col  ...       (sub)col  (sub)col  ...
           val       val      ...        val       val      ...

Upvotes: 7

Related Questions