Merge branch 'cassandra-1.2' into cassandra-2.0 Conflicts: CHANGES.txt NEWS.txt build.xml debian/changelog
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/49bb972c Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/49bb972c Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/49bb972c Branch: refs/heads/cassandra-2.0 Commit: 49bb972c6f79c6717b4750488bdcb035bb770784 Parents: 29670eb 16efdf4 Author: Sylvain Lebresne <sylv...@datastax.com> Authored: Wed Feb 5 16:36:50 2014 +0100 Committer: Sylvain Lebresne <sylv...@datastax.com> Committed: Wed Feb 5 16:36:50 2014 +0100 ---------------------------------------------------------------------- doc/cql3/CQL.textile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/49bb972c/doc/cql3/CQL.textile ---------------------------------------------------------------------- diff --cc doc/cql3/CQL.textile index cf73708,b18ce22..f82fc19 --- a/doc/cql3/CQL.textile +++ b/doc/cql3/CQL.textile @@@ -459,11 -443,9 +457,11 @@@ INSERT INTO NerdMovies (movie, director VALUES ('Serenity', 'Joss Whedon', 'Nathan Fillion', 2005) USING TTL 86400; - The @INSERT@ statement writes one or more columns for a given row in a table. Note that since a row is identified by its @PRIMARY KEY@, the columns that compose it must be specified. Also, since a row only exists when it contains one value for a column not part of the @PRIMARY KEY@, one such value must be specified too. + The @INSERT@ statement writes one or more columns for a given row in a table. Note that since a row is identified by its @PRIMARY KEY@, at least the columns composing it must be specified. -Note that unlike in SQL, @INSERT@ 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, @INSERT@ 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 @IF NOT EXISTS@ condition to only insert if the row does not exist prior to the insertion. But please note that using @IF NOT EXISTS@ will incur a non negligible performance cost (internally, Paxos will be used) so this should be used sparingly. All updates for an @INSERT@ are applied atomically and in isolation.