Range Queries in Cassandra (CQL 3.0)

后端 未结 2 1530
北恋
北恋 2021-02-14 21:44

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

2条回答
  •  无人及你
    2021-02-14 22:31

    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.

提交回复
热议问题