CQL IN 语法的应用方法

来源:互联网 发布:linux cpuinfo 编辑:程序博客网 时间:2024/06/09 23:09

In mypostabout the CQL WHERE clause I didn’t fully cover when the IN operator is supported and how it differs from the = operator. Based on the comments on that post and some questions I’ve gotten from people who read the post, I think it’s worth going into some detail about the IN operator.

Here’s where the IN operator is supported:

  1. The last column in the partition key, assuming the = operator is used on the first N-1 columns of the partition key
  2. The last clustering column, assuming the = operator is used on the first N-1 clustering columns and all partition keys are restricted
  3. The last clustering column, assuming the = operator is used on the first N-1 clustering columns and ALLOW FILTERING is specified
注意: IN的操作开销比普通=操作开销大很多,几乎是成指数倍的。假设factor=3 , 20个nodes, 采用Quramexi设计,select * from table where primary key in (1,2,3), 需要查6个nodes, 而如果是直接=只要查3个node即可。
0 0
原创粉丝点击