首页 文章

查询多个索引列时,cassandra可以使用多个本机二级索引吗?

提问于
浏览
1

查询多个索引列时,cassandra可以使用多个本机二级索引吗?

使用http://www.datastax.com/dev/blog/whats-new-cassandra-07-secondary-indexes中的规范示例

假设用户列族具有出生日期和状态的索引:

create column family users with comparator=UTF8Type
  and column_metadata=[{column_name: full_name, validation_class: UTF8Type},
  {column_name: birth_date, validation_class: LongType, index_type: KEYS},
  {column_name: state, validation_class: UTF8Type, index_type: KEYS}];

当我查询时:

get users where state = 'UT' and birth_date = 1970;

cassandra使用两个索引来获取行吗?

基于Compound Indexes in Apache Cassandra似乎答案是否定的

1 回答

  • 2

    你给的链接是正确的; Cassandra将选择最具选择性的索引并使用嵌套循环来评估其他谓词 .

相关问题