RSS
 

What’s the Difference Between a a SuperColumn and a SubColumn in Cassandra?

12 Jul

This article covers the difference between a supercolumn and a subcolumn in Cassandra.

Let me cut to the chase: there is no difference.  They are two terms for exactly the same thing.

If you are familiar with a typical keystore->column family->row->super column->column structure, such as the one pictured below, then you could safely replace all instances of the phrase “super column” with “subcolumn” without changing the meaning.

The confusion around “super column” vs. “sub column” is fueled largely by the Cassandra configuration file.  In your “storage-conf.xml” file you will see XML “ColumnFamily” configuration elements like this:

      <ColumnFamily Name="Super1"
                    ColumnType="Super"
                    CompareWith="BytesType"
                    CompareSubcolumnsWith="BytesType" />

If this was was a plain old “ColumnFamily” entry, you would only see this:

      <ColumnFamily Name="Regular1"
                    CompareWith="BytesType" />

…but this is a “Super Column Family”, so there are two extra attributes:

  • ColumnType=”Super” to tell Cassandra that this column family will contain super columns.
  • CompareSubcolumnsWith=”BytesType” to tell Cassandra that our sub columns will be sorted through bit-by-bit comparison.

Confused?  If so, go back and read the last two bullets again while telling yourself:
“super column = sub column = supercolumn = subcolumn…”

About Jonathan Lampe

Author of 43 articles on this blog.

I have about 12 years of experience designing secure, partially distributed systems (e.g., web farm with some extra load in one remote data center), often in industries such as finance and defense. My solutions and software are currently deployed in mission-critical roles at about 1000 enterprises worldwide. In the last 2-3 years I have turned my technical attention toward more geographically distributed systems and heterogeneous environments (e.g., a mix of operating systems or on-premises and cloud deployments) while maintaining my focus on good UX and great security.

Share

Published on Monday July 12, 2010 at 09:49am

 
Comments Off

Posted in Beginner, Cassandra

 

Comments are closed.