cassandra cql中限制的影响是什么

what is the impact of limit in cassandra cql

当执行像 select * from table limit 10 这样的 cqlsh 查询时,cassandra 会扫描整个 table 并且只扫描 return 前 10 条记录,或者它可以精确定位前 10 条记录数据中心而不扫描整个 table?

LIMIT 选项对查询返回的最大行数设置 upper-bound,但它不会阻止查询执行完整的 table 扫描。

Cassandra 具有请求超时等内部机制,可防止错误查询导致集群崩溃,因此查询更有可能超时,而不是通过扫描所有 nodes/replicas.

使集群过载

作为旁注,LIMIT 选项在与 SELECT COUNT() 一起使用时无关紧要,因为计数函数 returns 仅 1 行(按设计)。 COUNT() 需要进行完整的 table 扫描,而不考虑设置的限制。我在 post -- https://community.datastax.com/questions/6897/ 中对此进行了更详细的解释。干杯!

LIMIT 选项对查询返回的最大行数设置 upper-bound,但它不会阻止查询执行完整的 table 扫描。