Skip to Content
Cassandra: The Definitive Guide, 3rd Edition
book

Cassandra: The Definitive Guide, 3rd Edition

by Jeff Carpenter, Eben Hewitt
April 2020
Intermediate to advanced
426 pages
12h 4m
English
O'Reilly Media, Inc.
Content preview from Cassandra: The Definitive Guide, 3rd Edition

Chapter 9. Writing and Reading Data

Now that you understand the data model and how to use a simple client, let’s dig deeper into the different kinds of queries you can perform in Cassandra to write and read data. We’ll also take a look behind the scenes to see how Cassandra handles your queries. Understanding these details will help you design queries that will perform well and provide the behavior you need.

As with the previous chapter, we’ve included code samples using the DataStax Java Driver to help illustrate how these concepts work in practice.

Writing

Let’s start by noting some basic properties of writing data to Cassandra. First, writing data is very fast in Cassandra, because its design does not require performing disk reads or seeks. The memtables and SSTables save Cassandra from having to perform these operations on writes, which slows down many databases. All writes to disk in Cassandra are append only.

Because of the database commit log and hinted handoff design, the database is always writable, and within a row, writes are always atomic.

Write Consistency Levels

Cassandra’s tuneable consistency levels mean that you can specify in your queries how much consistency you require on writes. A higher consistency level means that more replica nodes need to respond, indicating that the write has completed. Higher consistency levels also come with a reduction in availability, as more nodes must be operational for the write to succeed. The implications of using the different ...

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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Cassandra: The Definitive Guide, 2nd Edition

Cassandra: The Definitive Guide, 2nd Edition

Jeff Carpenter, Eben Hewitt

Publisher Resources

ISBN: 9781098115159Errata Page