cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Wille <>
Subject Re: using or in select query in cassandra
Date Mon, 02 Mar 2015 18:04:11 GMT
I would also like to add that if you avoid IN and use async queries instead, it is pretty trivial
to use a semaphore or some other limiting mechanism to put a ceiling on the amount on concurrent
work you are sending to the cluster. If you use a query with an IN clause with a thousand
things, you’ll make the cluster look for a thousand records concurrently. If you issue a
thousand asyncQueries, and use a limiting mechanism, then you can control how much load you
are placing on the server.

I built a nice wrapper around the Session object, and one of the things that is built into
the wrapper is the ability to limit the number of concurrent async queries. It’s a really
nice and simple feature to have.


On Mar 2, 2015, at 10:33 AM, Jonathan Haddad <<>>

I'd like to add that in() is usually a bad idea.  It is convenient, but not really what you
want in production.  Go with Jens' original suggestion of multiple queries.

I recommend reading Ryan Svihla's post on why in() is generally a bad thing:

On Mon, Mar 2, 2015 at 12:36 AM Jens Rantil <<>>
Hi Rahul,

No, you can't do this in a single query. You will need to execute two separate queries if
the requirements are on different columns. However, if you'd like to select multiple rows
of with restriction on the same column you can do that using the `IN` construct:

select * from table where id IN (123,124);

See [1] for reference.



On Mon, Mar 2, 2015 at 7:06 AM, Rahul Srivastava <<>>
 I want to make uniqueness for my data so i need to add OR clause  in my WHERE clause.
ex: select * from table where id =123 OR name ='abc'
so in above i want that i get data if my id is 123 or my name is abc .

is there any possibility in cassandra to achieve this .

Jens Rantil
Backend engineer
Tink AB

Phone: +46 708 84 18 32

Facebook<!/> Linkedin<>

View raw message