Build Cloud-Native apps with Apache Cassandra

GOT QUESTIONS from the Workshop? You're in the right place! Post a question here and we'll get you answers.

Click here for Week 8 Materials and Homework.

Follow us on Eventbrite to get notified when new workshops are scheduled!


chandrasekar.b03_190734 avatar image
chandrasekar.b03_190734 asked Erick Ramirez edited

Will row cache store the data when the data is read for the first time?

In Cassandra, When the data is read for the first time from sstable, will the data be stored in row cache for the immediate access when it is read again?

What happens if the data in row cache is updated or deleted?

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

bettina.swynnerton avatar image
bettina.swynnerton answered


if row caching is enabled, Cassandra will detect frequently accessed partitions and store rows of data into RAM to limit the cases where it needs to read from disk.

When data is first read from the table, it's a row cache miss, and the row is cached for the next read.

For the next read it's a row cache hit, and the row is read from the cache.

If the row is updated or deleted later, the cache for it will be invalidated.

Here is a great blog with examples, if you want to practice for yourself. It is quite old, but the examples still work and illustrate very well when the row cache is hit. Note that you may have to enable the row cache first in the cassandra.yaml and restart your node (assuming you are working with your own installation of Cassandra).

I ran through the example to see if it still worked, the table create syntax is not quite right, use this one:

    user text, 
    status_id timeuuid, 
    status text, 
    PRIMARY KEY (user, status_id)) 
    AND caching = {'keys':'ALL', 'rows_per_partition':'10'};

But the rest is good.

Hope this answers your questions!

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.