Multiple partitions and read efficiency

In the real world, most users will likely follow dozens or hundreds of other users. In this case, our WHERE...IN clause will specify hundreds of partitions. Remember from Chapter 3, Organizing Related Data, that each partition is stored separately by Cassandra; querying hundreds of partitions would require hundreds of random accesses. In fact, Cassandra's official documentation warns us against using WHERE...IN in most circumstances.

Under most conditions, using IN in the WHERE clause is not recommended. Using IN can degrade performance because usually, many nodes must be queried.

Furthermore, in this particular case, Cassandra has to retrieve one page of rows from each partition, perform an ordered ...

Get Learning Apache Cassandra - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.