incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Brosius <>
Subject Re: Composite keys and composite columns
Date Fri, 18 Oct 2013 01:02:20 GMT
The explanation for Composite columns is muddied by verbage depending on 
whether you are talking about the thrift interface which tends to talk 
about things in low terms, or cql which tends to talk about things in 
higher level terms.

At a thrift/low level, a composite column, really now called a composite 
cell, is just a cell that has a name which contains multiple parts 
packed into a ByteBuffer. These multiple parts are understood by 
cassandra for validation, sorting and slicing purposes.

At a CQL level, there are really just compound keys, where the first 
part of a compound key is the partition key, it alone decides where the 
data lives (what node). The rest of the keys are clustering keys, and 
effect cql row sorting.

In CQL, then, columns that exist after columns which are part of the 
clustering keys, are grouped by those clustering keys. Under the cover 
these extra columns have names that are prefixed by the 
multipart-clustering name.

As for using column names as data, again it depends on the interface 
thrift/cql as to how to look at it. For instance with thrift you can 
slice columns that start from some value and end with some value, and 
find column names between. What shows up as columns probably means 
something to you.


On 10/17/2013 07:51 PM, Hartzman, Leslie wrote:
> Hi,
> I'm looking for clarification on composite keys and composite columns. 
> From what I've read with regards to composite keys, you have a 
> collection of columns where of 'n' columns, the first n-1 form the 
> composite primary key and the last column is the data for that 
> composite key. Do I have this right?
> What I've just read about composite columns is that there are static 
> and dynamic composite column names, but dynamic should be avoided. If 
> the column names can be created programmatically, what does the schema 
> definition look like for this, or is it omitted since they're 
> programmatically created? I'm assuming that these are the dynamic 
> composite columns. So how are the static composite columns defined in 
> the schema?
> Also, if a column name is used as the value as well (composite or 
> non-composite columns), how do you query that? If the value is empty 
> and the column name IS the value, is the knowledge of what you're 
> querying in the business logic due to the construct of that particular 
> column family?
> Thanks.
> Les
> [CONFIDENTIALITY AND PRIVACY NOTICE] Information transmitted by this 
> email is proprietary to Medtronic and is intended for use only by the 
> individual or entity to which it is addressed, and may contain 
> information that is private, privileged, confidential or exempt from 
> disclosure under applicable law. If you are not the intended recipient 
> or it appears that this mail has been forwarded to you without proper 
> authority, you are notified that any use or dissemination of this 
> information in any manner is strictly prohibited. In such cases, 
> please delete this mail from your records. To view this notice in 
> other languages you can either select the following link or manually 
> copy and paste the link into the address bar of a web browser: 

View raw message