Skip to Content
Mastering Apache Cassandra 3.x - Third Edition
book

Mastering Apache Cassandra 3.x - Third Edition

by Aaron Ploetz, Tejaswi Malepati
October 2018
Beginner to intermediate content levelBeginner to intermediate
348 pages
10h
English
Packt Publishing
Content preview from Mastering Apache Cassandra 3.x - Third Edition

Clustering key example

Let's say that we wanted to be able to offer up the same data, but to support a query for users by department. The table definition would change to something like this:

CREATE TABLE users_by_dept (  username TEXT,  email TEXT,  department TEXT,  title TEXT,  AD_groups TEXT,  PRIMARY KEY ((department),username))WITH CLUSTERING ORDER BY (username ASC)  AND COMPACTION = {'class':'LeveledCompactionStrategy',  'sstable_size_in_mb':'200'};

As the preceding table will be read more than it will be written to (users queried more often than they are added), we also designate use of LeveledCompactionStrategy.

The default compaction strategy is SizeTieredCompactionStrategy, which tends to favor read and write patterns that are either even ...
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

Mastering Apache Cassandra - Second Edition

Mastering Apache Cassandra - Second Edition

Nishant Neeraj

Publisher Resources

ISBN: 9781789131499Supplemental Content