如何执行“不在"在 cql3 查询中过滤选择?

编程入门 行业动态 更新时间:2024-10-26 08:26:02
本文介绍了如何执行“不在"在 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://www.youtube/watch?v=T_WRC_GjRd0&feature=youtu.be

http://youtu.be/x4Q9JeLIyNo

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

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

更多推荐

[db:关键词]

本文发布于:2023-03-28 16:30:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/733720.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!