Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

wdeng avatar image
wdeng asked Erick Ramirez edited

咨询个问题,在cassandra中,如果一个查询跨很多分区,是不是再怎么建索引都是的慢查询?

咨询个问题,在cassandra中,如果一个查询跨很多分区,是不是再怎么建索引都是的慢查询?

performancequery
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

wdeng avatar image
wdeng answered wdeng edited

如果查询跨很多分区的话,索引起不了什么作用。你应该考虑使用异步方式,增加查询的并发量。这样的话,每一个分区会被Driver发送给最优的Coordinator节点处理。一般情况下,这些分区都会均匀在所有节点上分布(这是由Cassandra内部使用的Consistent Hashing算法的特性决定的),所以并发查询很多分区的话,你可以让所有的节点同时都扮演Coordinator的角色,这样效率更高。最后查询的结果在客户端合并。

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.