Merge branch 'cassandra-1.2' into cassandra-2.0.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/cd471824 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/cd471824 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/cd471824 Branch: refs/heads/cassandra-2.0.0 Commit: cd47182458623fb7b0c5b447a5f8a5eff33beac9 Parents: 7a300c2 55fed33 Author: Sylvain Lebresne <sylv...@datastax.com> Authored: Wed Aug 21 12:15:59 2013 +0200 Committer: Sylvain Lebresne <sylv...@datastax.com> Committed: Wed Aug 21 12:15:59 2013 +0200 ---------------------------------------------------------------------- doc/cql3/CQL.textile | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/cd471824/doc/cql3/CQL.textile ---------------------------------------------------------------------- diff --cc doc/cql3/CQL.textile index ba90994,bb9a632..c87b9a5 --- a/doc/cql3/CQL.textile +++ b/doc/cql3/CQL.textile @@@ -500,11 -487,9 +502,11 @@@ WHERE movie = 'Serenity' UPDATE UserActions SET total = total + 2 WHERE user = B70DE1D0-9908-4AE3-BE34-5573E5B09F14 AND action = 'click'; p. - The @UPDATE@ statement writes one or more columns for a given row in a table. The @<where-clause>@ is used to select the row to update and must include all columns composing the @PRIMARY KEY@. Other columns values are specified through @<assignment>@ after the @SET@ keyword. + The @UPDATE@ statement writes one or more columns for a given row in a table. The @<where-clause>@ is used to select the row to update and must include all columns composing the @PRIMARY KEY@ (the @IN@ relation is only supported for the last column of the partition key). Other columns values are specified through @<assignment>@ after the @SET@ keyword. -Note that unlike in SQL, @UPDATE@ does not check the prior existence of the row: the row is created if none existed before, and updated otherwise. Furthermore, there is no mean to know which of creation or update happened. In fact, the semantic of @INSERT@ and @UPDATE@ are identical. +Note that unlike in SQL, @UPDATE@ does not check the prior existence of the row by default: the row is created if none existed before, and updated otherwise. Furthermore, there is no mean to know which of creation or update happened. + +It is however possible to use the conditions on some columns through @IF@, in which case the row will not be updated unless such condition are met. But please note that using @IF@ conditions will incur a non negligible performance cost (internally, Paxos will be used) so this should be used sparingly. In an @UPDATE@ statement, all updates within the same partition key are applied atomically and in isolation.