It’s pretty clear to me that the only thing that gets put into the caches are the top N rows.
https://github.com/apache/cassandra/blob/0db88242c66d3a7193a9ad836f9a515b3ac7f9fa/src/java/org/apache/cassandra/db/SinglePartitionReadCommand.java#L523 It may fetch more, but it doesn’t cache it. It may get more if its not the full partition cache, but theres no code that inserts into the CacheService except https://github.com/apache/cassandra/blob/0db88242c66d3a7193a9ad836f9a515b3ac7f9fa/src/java/org/apache/cassandra/db/SinglePartitionReadCommand.java#L528 -- Rahul Singh rahul.si...@anant.us Anant Corporation On Mar 12, 2018, 8:56 AM -0400, Hannu Kröger <hkro...@gmail.com>, wrote: > > > On 12 Mar 2018, at 14:45, Rahul Singh <rahul.xavier.si...@gmail.com> wrote: > > > > I may be wrong, but what I’ve read and used in the past assumes that the > > “first” N rows are cached and the clustering key design is how I change > > what N rows are put into memory. Looking at the code, it seems that’s the > > case. > > So we agree that we row cache is storing only N rows from the beginning of > the partition. So if only the last row in a partition is read, then it > probably doesn’t get cached assuming there are more than N rows in a > partition? > > > The language of the comment basically says that it holds in cache what > > satisfies the query if and only if it’s the head of the partition, if not > > it fetches it and saves it - I dont interpret it differently from what I > > have seen in the documentation. > > Hmm, I’m trying to understand this. Does it mean that it stores the results > in cache if it is head and if not, it will fetch the head and store that > (instead of the results for the query) ? > > Hannu