cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Lebresne <>
Subject Re: inserting rows in columns inside a supercolumn
Date Wed, 28 Apr 2010 11:21:51 GMT
> OK, I have solved my problems with Cassandra data model. Now I am using
> Column Families of type Super and SuperColumns with many columns inside.

You need to be aware of the third point of
That is, super columns are not indexed. Which means that super columns with
many columns inside is probably not a good idea (depending on what is "many" of
course), as any read of one column in the super column incurs the
reading of the whole
super column.

Note that in a lot of case (if you don't care about the second
ordering super column
provides for instance), it is actually pretty easy to go without super
column using
composed key. For instance, instead of
  rowKey1 -> superColumnName1 -> columnKey1, value1
                                                     columnKey2, value2
                                                     columnKey3, value3
  rowKey1 -> superColumnName2 -> columnKey1, value1
                                                     columnKey2, value2
you can do something along the line of :
  rowKey1 -> superColumnName1:columnKey1, value1
                   superColumnName1:columnKey2, value2
                   superColumnName1:columnKey3, value3
  rowKey1 -> superColumnName2:columnKey1, value1
                   superColumnName2:columnKey2, value2

> Thanks!
> 2010/4/16 Julio Carlos Barrera Juez <>
>> Hi again,
>> First of all, obviously, I have omitted the timestamps to make easy the
>> representation, not in the code. Secondly, there are one supercolumn with
>> two rows, A and D, all the others are columns, including B,
>> with various key-values (1, 2, etc.). I need two levels for my design, it is
>> mandatory, it means, I need supercolumns and columns.
>> I am trying to introduce key-value(-timestamp) 6, 7, 8 and 9; but when I
>> try to do it, the values are not appended to the other ones. Instead of
>> this, only the final value of each column is stored.
>> I am trying to append values in columns inside a supercolumn,
>> but maintaining old values.
>> All help will be appreciated. Thank you.
>> 2010/4/15 Miguel Verde <>
>>> Just to nitpick your representation a little bit, columnB/etc... are
>>> supercolumnB/etc..., key1/etc... are column1/etc..., and you can probably
>>> omit valueA/valueD designations entirely, it would still be understood.
>>> Columns in Cassandra always have timestamps, you can't omit them.
>>> Can you post a snippet of the code you are using and the error you get?
>>> On Thu, Apr 15, 2010 at 5:02 AM, Julio Carlos Barrera Juez
>>> <> wrote:
>>>> Hi all,
>>>> I'm working with Cassandra 0.5 and Thrift API. I have a simple doubt:
>>>> I want to insert a row in columns inside a supercolumn, like this
>>>> (without timestamps):
>>>> SuperColumnNameA ==> keyA valueA ==> columnB ==> key1 value1
>>>>    ==> key2 value2
>>>>    ==> key3 value3
       ==> columnC
>>>> ==> key4 value4
>>>>    ==> key5 value5
>>>>                                ==> keyD valueD ==>
columnE ==> key6
>>>> value6
>>>>    ==> key7 value7
       ==> columnF
>>>> ==> key8 value8
>>>>    ==> key9 value9
>>>> For instance, I want to insert only key-values 6,7,8 and 9, but when I
>>>> try it, I destroy all the others values. What is the correct mode to do it.
>>>> I have tries obtaining the supercolumn and adding more values,
>>>> bath_insert(), etc, but I always failing.
>>>> Thank you.

View raw message