Several columns in Cassandra tables

I am wondering what happens when there are multiple Non-PK columns in a table. I read this example: http://johnsanda.blogspot.co.uk/2012/10/why-i-am-ready-to-move-to-cql-for.html

Which shows that with a single column:

CREATE TABLE raw_metrics (
schedule_id int,
time timestamp,
value double,
PRIMARY KEY (schedule_id, time)
);

We get:

enter image description here

Now I wonder what happens when we have two columns:

CREATE TABLE raw_metrics (
schedule_id int,
time timestamp,
value1 double,
value2 int,
PRIMARY KEY (schedule_id, time)
);

We get something like:

row key  columns...
123      1339707619:"value1" | 1339707679:"value2" | 1339707784:"value2"
...

or rather:

row key  columns...
123      1339707619:"value1":"value2" | 1339707679:"value1":"value2" | 1339707784:"value1""value2"
...

etc .. I suppose I ask if this table will be sparse if I only insert the values ​​"value1" or "value2".

In such situations, if I want to store more columns (one for each type, for example double, int, date, etc.), would it be better to have separate tables, rather than storing everything in one table?

+5
1

, : Cassandra Composite Columns - CompositeTypes?

, :

row key  columns...
123      1339707619:"value1" | 1339707679:"value2" | 1339707784:"value2"

. : http://wiki.apache.org/cassandra/SecondaryIndexes

+1

All Articles