cassandra 2.1 - Difference between CQL insert and update? -
i'm new cassandra , come relational world. when playing cql observed didn't find difference. ex:
when execute below query
update product set price=100, currency=usd productid=12345;
then cql creates new row in table. in rdbms won't work since there no product productid = 12345.
can provide insight ?
what you've discovered cassandra writes (with few exceptions) writes without reads. there number of reasons - 1 performance (reading first slow), consider first insert may have happened on server, , not yet replicated server processing update.
what you're saying "set price $100usd product 12345". if no such product exists (yet?), it's still setting price, because it's not going take time find out if product exists.
if need check if row exists, cassandra provides paxos implementation lightweight transactions ( http://www.datastax.com/dev/blog/lightweight-transactions-in-cassandra-2-0 ) can provide if [not exists]
type logic (at significant performance penalty).
Comments
Post a Comment