You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by diwayou <di...@vip.qq.com> on 2015/02/06 12:21:55 UTC
how to batch the select query to reduce network communication
create table t {
a int,
b int,
c int
}
if i want to execute
select * from t where a = 1 and b = 2 limit 10;
select * from t where a = 1 and b = 3 limit 10;
how can i batch this, and only execute once to get the result
Re: how to batch the select query to reduce network communication
Posted by Jens Rantil <je...@tink.se>.
As an alternative, you could always execute the async to Cassandra and then
iterate over the results as they come in.
Cheers,
Jens
On Fri, Feb 6, 2015 at 12:39 PM, Carlos Rolo <ro...@pythian.com> wrote:
> Hi,
>
> You can't. Batches are only available for INSERT, UPDATE and DELETE
> operations. Batches exist to give Cassandra some atomicity, as in, or all
> operations succeed or all fail.
>
> Regards,
>
> Regards,
>
> Carlos Juzarte Rolo
> Cassandra Consultant
>
> Pythian - Love your data
>
> rolo@pythian | Twitter: cjrolo | Linkedin: *linkedin.com/in/carlosjuzarterolo
> <http://linkedin.com/in/carlosjuzarterolo>*
> Tel: 1649
> www.pythian.com
>
> On Fri, Feb 6, 2015 at 12:21 PM, diwayou <di...@vip.qq.com> wrote:
>
>> create table t {
>> a int,
>> b int,
>> c int
>> }
>> if i want to execute
>> select * from t where a = 1 and b = 2 limit 10;
>> select * from t where a = 1 and b = 3 limit 10;
>>
>> how can i batch this, and only execute once to get the result
>>
>
>
> --
>
>
>
>
--
Jens Rantil
Backend engineer
Tink AB
Email: jens.rantil@tink.se
Phone: +46 708 84 18 32
Web: www.tink.se
Facebook <https://www.facebook.com/#!/tink.se> Linkedin
<http://www.linkedin.com/company/2735919?trk=vsrp_companies_res_photo&trkInfo=VSRPsearchId%3A1057023381369207406670%2CVSRPtargetId%3A2735919%2CVSRPcmpt%3Aprimary>
Twitter <https://twitter.com/tink>
Re: how to batch the select query to reduce network communication
Posted by Carlos Rolo <ro...@pythian.com>.
Hi,
You can't. Batches are only available for INSERT, UPDATE and DELETE
operations. Batches exist to give Cassandra some atomicity, as in, or all
operations succeed or all fail.
Regards,
Regards,
Carlos Juzarte Rolo
Cassandra Consultant
Pythian - Love your data
rolo@pythian | Twitter: cjrolo | Linkedin: *linkedin.com/in/carlosjuzarterolo
<http://linkedin.com/in/carlosjuzarterolo>*
Tel: 1649
www.pythian.com
On Fri, Feb 6, 2015 at 12:21 PM, diwayou <di...@vip.qq.com> wrote:
> create table t {
> a int,
> b int,
> c int
> }
> if i want to execute
> select * from t where a = 1 and b = 2 limit 10;
> select * from t where a = 1 and b = 3 limit 10;
>
> how can i batch this, and only execute once to get the result
>
--
--