incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Lebresne <sylv...@datastax.com>
Subject Re: question about where clause of CQL update statement
Date Tue, 09 Oct 2012 07:30:10 GMT
> Is it not possible to include a column in both the set clause and in the where clause?

No it's not. Or rather in that case what is not supported is the use
of secondary indexes in update where clauses. But if 'locked' is
indeed not part of your primary key, then at least the error message
suck and will need to be improved.

Now, why isn't this supported? Honestly I don't remember that we have
discussed this much, but I see at least 2 potential reasons why we
might hesitate doing it:
1) we won't really be able to implement this in a much better way that
you would do client (i.e. by first querying the secondary index and
then doing the insertion). In particular, we won't be able to
guarantee the atomicity of the read/write involved by such operation.
2) currently writes don't involve read (that isn't true for 2ndary
index updates currently but that will be fixed in Cassandra 1.2). That
would be a case where a write involves a read, and a fairly costly
one.

This is not saying this is a bad idea, just that there is more to it
than "we've been too lazy to implement it". But if you are interested
I encourage you to open a ticket on JIRA to start a discussion.

--
Sylvain

Mime
View raw message