cu111
cu111

Reputation: 71

Reading the most recent updated row in cassandra

I have a use case and want suggestion on the below.

Structure :

            Rowkey_1: 

                       Column1 = value1;
                       Column2 = value2;
            Rowkey_2: 

                       Column1 = value1;
                       Column2 = value2;

" Suppose i am writing 1000 rows into cassandra with each row having couple of columns. After sometime i update only 100 rows and make changes for column values ".

-> when i read data from cassandra i only want to get these 100 updated rows and not the entire row key information.

Is there a way to say to cassandra like give me all row keys from start - > end where time in between "Time_start" to "Time_end"

in SQL Lingo -- > select from "" to "" where time between "time_start" and "time_end".

P.S. i read Basic Time Series with Cassandra where it says you can annotate rowkey like the below Inserting data — {:key => ‘server1-load-20110306′, :column_name => TimeUUID(now), :column_value => 0.75}

Here the column family has TimeUUID columns.

My question is can you annotate you rowkey with date and time like this : { :key ==> 2012-11-18 16:00:15 }

OR any other way to get only the recent updated rows.

Any suggestion/ guidance really appreciated.

Upvotes: 1

Views: 715

Answers (1)

rs_atl
rs_atl

Reputation: 8985

You can't do range queries on keys unless you use ByteOrderedPartitioner, which you shouldn't use. The way to do this is by writing known sentinel values as keys, such as a timestamp representing the beginning of the day. Then you can do the column slice by time.

Upvotes: 2

Related Questions