如何执行“不在"在 cql3 查询中过滤选择? [英] how to perform "not in" filter in cql3 query select?

查看:22
本文介绍了如何执行“不在"在 cql3 查询中过滤选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要获取没有特定键的行.示例:

I need to fetch rows without specific keys. for sample:

 select * from users where user_id not in ("mikko");

我试过不在",这是回应:

I have tried with "not in" and this is the response:

Bad Request: line 1:35 no viable alternative at input 'not'

推荐答案

not in"在 CQL 中不受支持.Cassandra 的核心仍然基于键索引行.因此该查询与select * from users"基本相同,因为您必须遍历每一行并确定它是否与输入不匹配.如果您想执行这种类型的查询,您将需要设置一个地图减少作业来执行它.

"not in" is not a supported operation in CQL. Cassandra at its heart is still based on key indexed rows. So that query is basically the same as "select * from users", as you have to go through every row and figure out if it does not match the in. If you want to do that type of query you will want to setup a map reduce job to perform it.

在使用 Cassandra 时,您真正想要做的是对数据模型进行反规范化,以便您的应用程序执行的查询最终查询单个分区(或仅几个分区)以获取结果.

When using Cassandra what you actually want to do is de-normalize your data model so that the queries you application performs end up querying a single partition (or just a few partitions) for their results.

还可以找到一些很棒的网络研讨会和关于 Cassandra 数据建模的演讲

Also find some great webinars and talks on Cassandra data modeling

http://youtu.be/x4Q9JeLIyNo

http://www.youtube.com/watch?v=HdJlsOZVGwM&list=PLqcm6qE9lgKJzVvwHprow9h7KMpb5hcUU&index=10

这篇关于如何执行“不在"在 cql3 查询中过滤选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆