Cassandra的索引结构是什么

问题描述:

Cassandra使用LSM树进行存储,但是cassandra的索引结构到底是什么?例如,Mongo和Couchbase都使用BTree.

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

这取决于您实际使用的Cassandra版本.

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

对于3.4之前的版本,索引被实现为隐藏的Cassandra表,其中包含您要访问的数据的键值.这种策略的主要缺点是,由于SStables受到压缩,因此您不能直接引用数据,而是要给它提供密钥,并且必须再次经过读取路径.

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.

在3.4版中,他们引入了SASI索引(SSTable附加二级索引).基本上,索引的一部分与每个SStable相关联,因此与之一起分发.这意味着您实际上可以使用引用来访问数据,而不必为另一个读取路径付费.在实现方面,它们是b树.

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.

此处是关于主题.