As far as I know, when we create clustered index it restructures the table in B-Tree form and uses binary search when we try to find particular row. SSTable is also sorted by key. Why do we need Sparse Index as a reference table for this case ? How does it differ from B-Tree regarding to search if they are ordered by key ? Why applying binary search isn't enough ?

I tried to find the exact usage of Sparse Index and tried to understand why is it needed as a reference table if we do not need this kind of thing for clustered index and I didn't find any answer to this question.

1 Answer 1


Cassandra uses multiple schemes to speed up the process of retrieving data.

One of those schemes include an index of partitions and their corresponding disk offset. This partition index has a corresponding partition summary which contains a sample of N partition keys and a map to their location in the partition index.

When retrieving data, Cassandra checks the partition summary to get the "closest" location of the partition so saves time by not having to scan the whole partition index.

Imagine a node which has over 100K SSTables. Without the index, Cassandra would need to scan all those files in order to retrieve the requested data. With the indexes and caches, the data retrieval is so much faster by orders of magnitude.

If you're interested in the details, see How Cassandra reads data. Cheers!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.