简体   繁体   中英

What is the index structure of Cassandra

Cassandra uses LSM tree for storage, but what exactly is the index structure of cassandra ? For eg Both Mongo and Couchbase use BTree.

It depends on the version of Cassandra you are actually using.

For version prior to 3.4 indexes are implemented as hidden Cassandra tables holding the key value of the data you wish to access. Main disadvantage of this strategy is that since SStables are subjected to compactions, you cannot reference data directly, instead you are given a key, and you have to go through the read path again.

In version 3.4 they introduced SASI indexes (SSTable Attached Secondary Indexes). Basically a portion of the index is associated to each SStable and hence distributed with it. This means you can actually use references to access data rather than pay for another read path. In terms of implementation, they are b-trees.

Here is a really useful resource on the subject.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM