You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Kevin Cox <ke...@wscon.com> on 2010/08/08 22:29:57 UTC

Question about column insert history

Taking from the CassandaraCLI example page for simplicity, one enters the following into the

cassandra> set Keyspace1.Standard2['jsmith']['age'] = '42'

cassandra> get Keyspace1.Standard2['jsmith']              
=> (column=last, value=Smith, timestamp=1279780450578000)
=> (column=first, value=John, timestamp=1279780434745000)
=> (column=age, value=42, timestamp=1279780457458000)
Returned 3 results.

cassandra> set Keyspace1.Standard2['jsmith']['age'] = '43'
Value inserted.

cassandra> set Keyspace1.Standard2['jsmith']['age'] = '44'
Value inserted.

cassandra> get Keyspace1.Standard2['jsmith'] ['age']   
=> (column=age, value=44, timestamp=1281297196787000)   <<< 44 is the current value

How could I get access to the previous values of the age column? (like values 42 and 43 and their timestamps that were entered prior to value 44)
Are previous values kept or replaced in Cassandra?
Is there any way to preserve and/or access column history?

Thanks.

Re: Question about column insert history

Posted by Benjamin Black <b...@b3k.us>.
You don't, they are not preserved, as discussed in another, almost
identical thread in the past 2 days.  If you want to retain history,
you must do so your self, usually by maintaining indices.

On Sun, Aug 8, 2010 at 1:29 PM, Kevin Cox <ke...@wscon.com> wrote:
> Taking from the CassandaraCLI example page for simplicity, one enters the following into the
>
> cassandra> set Keyspace1.Standard2['jsmith']['age'] = '42'
>
> cassandra> get Keyspace1.Standard2['jsmith']
> => (column=last, value=Smith, timestamp=1279780450578000)
> => (column=first, value=John, timestamp=1279780434745000)
> => (column=age, value=42, timestamp=1279780457458000)
> Returned 3 results.
>
> cassandra> set Keyspace1.Standard2['jsmith']['age'] = '43'
> Value inserted.
>
> cassandra> set Keyspace1.Standard2['jsmith']['age'] = '44'
> Value inserted.
>
> cassandra> get Keyspace1.Standard2['jsmith'] ['age']
> => (column=age, value=44, timestamp=1281297196787000)   <<< 44 is the current value
>
> How could I get access to the previous values of the age column? (like values 42 and 43 and their timestamps that were entered prior to value 44)
> Are previous values kept or replaced in Cassandra?
> Is there any way to preserve and/or access column history?
>
> Thanks.
>

Re: Question about column insert history

Posted by Aaron Morton <aa...@thelastpickle.com>.
Short answer, you should consider the previous values replaced. 

Longer, they are kept around for a while but are not available outside of cassandra. They are removed at the next Major compaction, if the change happened more than GCGraceSeconds ago http://www.mail-archive.com/user@cassandra.apache.org/msg05072.html

If you want to store a history you can always store the data twice, say in one CF for the current values and one for the history. 


Aaron


On 09 Aug, 2010,at 08:29 AM, Kevin Cox <ke...@wscon.com> wrote:

Taking from the CassandaraCLI example page for simplicity, one enters the following into the

cassandra> set Keyspace1.Standard2['jsmith']['age'] = '42'

cassandra> get Keyspace1.Standard2['jsmith'] 
=> (column=last, value=Smith, timestamp=1279780450578000)
=> (column=first, value=John, timestamp=1279780434745000)
=> (column=age, value=42, timestamp=1279780457458000)
Returned 3 results.

cassandra> set Keyspace1.Standard2['jsmith']['age'] = '43'
Value inserted.

cassandra> set Keyspace1.Standard2['jsmith']['age'] = '44'
Value inserted.

cassandra> get Keyspace1.Standard2['jsmith'] ['age'] 
=> (column=age, value=44, timestamp=1281297196787000) <<< 44 is the current value

How could I get access to the previous values of the age column? (like values 42 and 43 and their timestamps that were entered prior to value 44)
Are previous values kept or replaced in Cassandra?
Is there any way to preserve and/or access column history?

Thanks.