2

The goal of a Cassandra Batch statement is to group statements on the one partition together in a single atomic operation (all pass or fail together).

This is quite similar to how an SQL Transaction works.

To me it seems the main difference is that with an SQL Transaction, you get an ACID consistency guarantee at the end of it, which you don't necessarily get with a Cassandra Batch statement.

My question is: What are the similarities and differences between a BATCH statement in Cassandra and a Transaction in SQL?

hawkeye
  • 34,745
  • 30
  • 150
  • 304

2 Answers2

2

Cassandra only support Atomicity and Isolation at the partition level

Cassandra does not use RDBMS ACID transactions with rollback or locking mechanisms, but instead offers atomic, isolated, and durable transactions with eventual/tunable consistency that lets the user decide how strong or eventual they want each transaction’s consistency to be.

As a non-relational database, Cassandra does not support joins or foreign keys, and consequently does not offer consistency in the ACID sense

Read More : http://docs.datastax.com/en/cassandra/3.0/cassandra/dml/dmlTransactionsDiffer.html

Community
  • 1
  • 1
Ashraful Islam
  • 12,470
  • 3
  • 32
  • 53
1

The answer is already in your question: one partition

Which means, that C*'s batch is not an universal tool to maintain consistency and atomicity like transactions in RDBMS. It is not possible to maintain strict atomicity and consistency across nodes with C* batches, so in a busines usecase set, there are many "transactions" what could be / should be atomic, but you can not use C* batch to ensure that, because the data included those "transactions" are split on multiple nodes.

g.pickardou
  • 32,346
  • 36
  • 123
  • 268