how to perform “not in” filter in cql3 query select?

后端 未结 1 1681
陌清茗
陌清茗 2021-01-12 03:13

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\"

相关标签:
1条回答
  • 2021-01-12 03:38

    "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.

    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.

    Also find some great webinars and talks on Cassandra data modeling

    • http://www.youtube.com/watch?v=T_WRC_GjRd0&feature=youtu.be

    • http://youtu.be/x4Q9JeLIyNo

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

    0 讨论(0)
提交回复
热议问题