cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Qi Li <ken.l...@gmail.com>
Subject Wide row in Cassandra
Date Thu, 28 Jan 2016 22:51:14 GMT
Hi all,

I've found something in Internet, but still want to consult with your
expertise.

I'm designing a table, the object model will be like,
class Data{
     String uuid;        //partition key
     String value1;
     String value2;
     ...
     String valueN;
     Map<String, Double> mapValues;
}


For one Data object, I would like it to be saved into one wide row in C*,
that means the mapValues will be extended as dynamic columns. AFAIK, I can
put the mapValues' key into Cluster column, then C* will use the wide row
to save the data. Then I would use 'uuid' as partition key, and mapKey into
cluster key. My question is for the other columns : value1 to valueN, shall
I put them into ClusterKey too? like below,

create table Data (
   text uuid;
   text value1;
   text value2;
   ...
   text valueN;
   text mapKey;
   Double mapValue;
   primary key(key, mapKey, value1, value2, ..., valueN);
);

The reason I put them into cluster keys is I don't want value1 to valueN
are saved duplicated each time when the mapKey is created. For example, the
mapValues can have 100 entries, I don't want value1 to valueN are saved 100
times, I only want them saved 1 time together with the partition key. Is
this correct?

Thanks for your help.

-- 
Ken Li

Mime
View raw message