- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Cassandra CQL3 SELECT
语句允许使用 IN
元组,如 in
SELECT * FROM posts
WHERE userid='john doe' AND (blog_title, posted_at)
IN (('John''s Blog', '2012-01-01), ('Extreme Chess', '2014-06-01'))
从 CQ3 规范中可以看出:http://cassandra.apache.org/doc/cql3/CQL.html#selectStmt
SELECT 的 IN 子句中可以使用的元组数量有限制吗?最大值是多少?
最佳答案
DataStax 的 Rebecca Mills 对 IN
语句(Things you should be doing when using Cassandra drivers - 第 22 点)中允许的键数提供了明确的限制:
...specifically the limit on the number of keys in an IN statement, the most you can have is 65535. But practically speaking you should only be using small numbers of keys in INs, just for performance reasons.
我假设该限制也适用于您可以指定的元组数量。不过老实说,我不会试图超越这一点。如果你发送的数量很大,它根本不会表现良好。 CQL documentation on the SELECT CLAUSE警告用户:
When not to use IN
The recommendations about when not to use an index apply to using IN in the WHERE clause. Under most conditions, using IN in the WHERE clause is not recommended. Using IN can degrade performance because usually many nodes must be queried. For example, in a single, local data center cluster with 30 nodes, a replication factor of 3, and a consistency level of LOCAL_QUORUM, a single key query goes out to two nodes, but if the query uses the IN condition, the number of nodes being queried are most likely even higher, up to 20 nodes depending on where the keys fall in the token range.
可以说,虽然您可以通过的元组的最大数量是一个数学问题,但您应该通过的元组数量将取决于您的集群配置, JVM实现,还有一点常识。
关于select - CQL3 SELECT...IN 子句中的元组数量是否有任何限制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24350842/
我是一名优秀的程序员,十分优秀!