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 BFF75D637 for ; Wed, 11 Jul 2012 13:32:11 +0000 (UTC) Received: (qmail 88162 invoked by uid 500); 11 Jul 2012 13:32:09 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 87993 invoked by uid 500); 11 Jul 2012 13:32:08 -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 87980 invoked by uid 99); 11 Jul 2012 13:32:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jul 2012 13:32:07 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FSL_RCVD_USER,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sylvain@datastax.com designates 209.85.220.172 as permitted sender) Received: from [209.85.220.172] (HELO mail-vc0-f172.google.com) (209.85.220.172) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jul 2012 13:32:02 +0000 Received: by vcqp1 with SMTP id p1so798058vcq.31 for ; Wed, 11 Jul 2012 06:31:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding:x-gm-message-state; bh=w2L7/A2jsfCPcJcTZwnE00PS0BnD+Cn1qmGROindows=; b=cDEYNR1mZSvWDqjEVPU+znNS0IM11izjn7Q4zq10LXlJzsHO9rnk37OhUMddR39hyi L4WNYTUJXKW8NP8nlCV50HL/Dv1EgaloEIP6CJb339LGzP/V0LRD78gZXptRyUC0V2ut upHYELIVORZuuZ2LhsYzqFMLIlyvGehFKxrDVmEByLej73yxDMf0sZNyyvJoDDBarS8T 4aysblxFZ0R6BnH4vYvCAvkCA5JyBALJxnO6IZJrwz47z9nm4YsuvKeNwuNGgXkYMBoP 7k2nK/fAubvVXRDyCjpCBVA+Iej7eMiiQuDHb0wtEEj2ee5sgAy0m7TV7BKJwxt0AziX aEPQ== MIME-Version: 1.0 Received: by 10.220.39.206 with SMTP id h14mr23270616vce.63.1342013501712; Wed, 11 Jul 2012 06:31:41 -0700 (PDT) Received: by 10.220.101.132 with HTTP; Wed, 11 Jul 2012 06:31:41 -0700 (PDT) In-Reply-To: References: <399CB8C7-AEE6-4468-91E0-BF06D6118BD8@thelastpickle.com> Date: Wed, 11 Jul 2012 15:31:41 +0200 Message-ID: Subject: Re: help using org.apache.cassandra.cql3 From: Sylvain Lebresne To: user@cassandra.apache.org Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQkvhLqCadzN8fEWavwcPY8vKR3fcs4F9hzo+wVeioGoSB3yy+Tll5DTS4jZ4QjnbRcWqjpc X-Virus-Checked: Checked by ClamAV on apache.org When I said to use the BATCH statement I mean't using a query that is a BATCH statement, so something like: BEGIN BATCH INSERT ...; INSERT ...; ... APPLY BATCH; If you want to that from java, you will want to look at the jdbc driver (http://code.google.com/a/apache-extras.org/p/cassandra-jdbc/), though I don't know what is the status of the support for CQL3. On Wed, Jul 11, 2012 at 2:18 PM, Leonid Ilyevsky wrote: > Is it OK to put 10000 of update statements in one > batch, with 50000 question marks in it? The set that many variables? Yes batch statement can be prepared and in theory there isn't much limit on the number of update statement (nor question marks) you can put in one batch. However, the way C* work best is if you do reasonably sized batches. It's even more true for CQL in the sense that by using a huge batch statement you'll pay the parsing. So you probably want to prepare one batch statement with a reasonable number of statement in it (you'll have to test to find number that give the best performances, but I would typically start with say 50-100 and see if the performance are good enough) and reuse that to insert the data. The other reason why breaking the insert into smallish batches is a good idea is that it allows you to parallelize the insert using multiple threads. And you need to parallelize if you want to get the best out of C*. -- Sylvain > > Maybe I can try small example first, just to see if it works at all. > > > > > > From: Derek Williams [mailto:derek@fyrie.net] > Sent: Tuesday, July 10, 2012 7:19 PM > To: user@cassandra.apache.org > Subject: Re: help using org.apache.cassandra.cql3 > > > > On Tue, Jul 10, 2012 at 3:04 PM, Leonid Ilyevsky > wrote: > > I am trying to use the org.apache.cassandra.cql3 package. Having problem > connecting to the server using ClientState. > > I was not sure what to put in the credentials map (I did not set any > users/passwords on my server), so I tried setting empty strings for > =93username=94 and =93password=94, setting them to bogus values, passing = null to the > login method =96 there was no difference. > > It does not complain at the login(), but then it complains about > setKeyspace(), saying that the specified keyspace does not > exist (it obviously does exist). > > The configuration was loaded from cassandra.yaml used by the server. > > > > I did not have any problem like this when I used > org.apache.cassandra.thrift.Cassandra.Client . > > > > What am I doing wrong? > > > > I think that package just contains server classes. Everything you need > should be in org.apache.cassandra.thrift. > > > > To use cql3 I just use the client methods 'execute_cql_query', > 'prepare_cql_query' and 'execute_prepared_cql_query', after setting cql > version to '3.0.0'. > > > > > > -- > > Derek Williams > > > > > ________________________________ > This email, along with any attachments, is confidential and may be legall= y > privileged or otherwise protected from disclosure. Any unauthorized > dissemination, copying or use of the contents of this email is strictly > prohibited and may be in violation of law. If you are not the intended > recipient, any disclosure, copying, forwarding or distribution of this em= ail > is strictly prohibited and this email and any attachments should be delet= ed > immediately. This email and any attachments do not constitute an offer to > sell or a solicitation of an offer to purchase any interest in any > investment vehicle sponsored by Moon Capital Management LP (=93Moon Capit= al=94). > Moon Capital does not provide legal, accounting or tax advice. Any statem= ent > regarding legal, accounting or tax matters was not intended or written to= be > relied upon by any person as advice. Moon Capital does not waive > confidentiality or privilege as a result of this email.