Range Queries in Cassandra (CQL 3.0)

后端 未结 1 1042
[愿得一人]
[愿得一人] 2021-02-14 22:19

One main part of Cassandra that I don\'t fully understand is its range queries. I know that Cassandra emphasizes distributed environment and focuses on performance, but probabl

1条回答
  •  梦谈多话
    2021-02-14 22:47

    You can look for clustering keys. A primary key can be formed by a partitioning key and then by clustering keys.

    for example definition like this one

    CREATE TABLE example (
      int_key int,
      int_non_key int,
      str_2nd_idx ascii,
      PRIMARY KEY((int_key), str_2nd_idx)
    );
    

    will allow to you make queries like these without using token

    select * from example where str_2nd_idx < 'hello' allow filtering;
    

    Before creating a TABLE in cassandra you should start from thinking about queries and what you want to ask from the data model in cassandra.

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