Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 908F94664 for ; Mon, 23 May 2011 21:55:54 +0000 (UTC) Received: (qmail 47947 invoked by uid 500); 23 May 2011 21:55:52 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 47923 invoked by uid 500); 23 May 2011 21:55:52 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 47915 invoked by uid 99); 23 May 2011 21:55:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 May 2011 21:55:52 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of nate@datastax.com designates 74.125.82.44 as permitted sender) Received: from [74.125.82.44] (HELO mail-ww0-f44.google.com) (74.125.82.44) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 May 2011 21:55:46 +0000 Received: by wwa36 with SMTP id 36so5702597wwa.25 for ; Mon, 23 May 2011 14:55:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.82.77 with SMTP id n55mr2684921wee.52.1306187725105; Mon, 23 May 2011 14:55:25 -0700 (PDT) Received: by 10.216.168.2 with HTTP; Mon, 23 May 2011 14:55:24 -0700 (PDT) X-Originating-IP: [64.132.24.216] In-Reply-To: References: Date: Mon, 23 May 2011 16:55:24 -0500 Message-ID: Subject: Re: Cassandra 0.8 questions From: Nate McCall To: user@cassandra.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable The Mutator#insert signature is a single insertion operation. To "batch" operations, use Mutator#addInsertion. You must then call Mutator#execute to send the batched operations. For Hector specific questions, feel free to sign up for hector-users@googlegroups.com as well. On Mon, May 23, 2011 at 4:47 PM, Jian Fang wrote: > 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 firs= t > 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 =3D HFactory.createMutator(keyspace, stringSerializer); > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 //Mutator m =3D > HFactory.createMutator(keyspace,stringSerializer); > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 m.insert(p.getCassandraKey(= ), colFamily, > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 HFa= ctory.createStringColumn("type", > p.getStringValue())); > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 m.insert(p.getCassandraKey(= ), colFamily, > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 HFa= ctory.createColumn("data", p.getCompressedXML(), > StringSerializer.get(), > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 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 o= ne > 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 e= ach > category includes a category id and a category description. Usually, how = do > people handle this scenario when they use Cassandra? > > Thanks in advance, > > John >