incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jian Fang <jian.fang.subscr...@gmail.com>
Subject Cassandra 0.8 questions
Date Mon, 23 May 2011 21:47:14 GMT
Hi,

I am pretty new to Cassandra and am going to use Cassandra 0.8.0. I have two
questions (sorry if they are very basic ones):

1) I have a column family to hold many super columns, say 30. When I first
insert the data to the column family, do I need to insert each column one at
a time or can I insert the whole column family in one transaction (or
call?)? The latter one seems to be more efficient to me. Does Cassandra
support that?

For example, I saw the following code to do insertion (with Hector),

Mutator m = HFactory.createMutator(keyspace, stringSerializer);
                //Mutator<String> m =
HFactory.createMutator(keyspace,stringSerializer);
                m.insert(p.getCassandraKey(), colFamily,
                        HFactory.createStringColumn("type",
p.getStringValue()));
                m.insert(p.getCassandraKey(), colFamily,
                        HFactory.createColumn("data", p.getCompressedXML(),
StringSerializer.get(),
                                BytesArraySerializer.get()));

Will the insertions be two separate calls to Cassandra? Or they are just one
transaction? If it is the former case, is there any way to make them as one
call to Cassandra?

2) How to store a list/array of data in Cassandra? For example, I have a
data field called categories, which include none or many categories and each
category includes a category id and a category description. Usually, how do
people handle this scenario when they use Cassandra?

Thanks in advance,

John

Mime
View raw message