Skip to Content
Cassandra: The Definitive Guide
book

Cassandra: The Definitive Guide

by Eben Hewitt
November 2010
Intermediate to advanced
328 pages
9h 38m
English
O'Reilly Media, Inc.
Content preview from Cassandra: The Definitive Guide

Chapter 7. Reading and Writing Data

Now that we understand the data model, we’ll look at the different kinds of queries you can perform in Cassandra to read and write data. In this chapter, we use Cassandra 0.6.7-beta1, which is the most recent release version at the time of this writing.

Query Differences Between RDBMS and Cassandra

There are several differences between Cassandra’s model and query methods and what’s available in RDBMS, and these are important to keep in mind.

No Update Query

There is no first-order concept of an update in Cassandra, meaning that there is no client query called an “update.” You can readily achieve the same effect, however, by simply performing an insert using an existing row key. If you issue an insert statement for a key that already exists, Cassandra will overwrite the values for any matching columns; if your query contains additional columns that don’t already exist for that row key, then the additional columns will be inserted. This is all seamless.

Record-Level Atomicity on Writes

Cassandra automatically gives you record-level atomicity on every write operation. In RDBMS, you would have to specify row-level locking. Although Cassandra offers atomicity at the column family level, it does not guarantee isolation.

No Server-Side Transaction Support

Because you need to denormalize tables to create secondary indexes, you might need to insert data into two or more tables (one for your primary table and one for your inverted or secondary index). This means ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Cassandra: The Definitive Guide, 3rd Edition

Cassandra: The Definitive Guide, 3rd Edition

Jeff Carpenter, Eben Hewitt
Data modeling with Cassandra

Data modeling with Cassandra

Jeff Carpenter, Eben Hewitt

Publisher Resources

ISBN: 9781449399764Supplemental ContentErrata Page