Query Cassandra using a partial partition key

In Cassandra, I can create a composite partition key, separate from my clustering key:

CREATE TABLE footable ( column1 text, column2 text, column3 text, column4 text, PRIMARY KEY ((column1, column2)) ) 

As I understand it, quering by partition key is an extremely efficient (most efficient?) Method for retrieving data. However, I do not know if it is also effective for querying only part of the partition’s composite key.

In MSSQL, this will be effective if the components are included starting from the first (column1 instead of column2, in this example). Is it so in Kassandra? This is a very efficient query for rows based only on column1, here?

+7
cassandra cql
source share
2 answers

This is not so in Kassandra, because it is impossible. This will result in the following error:

The essence of the section section should be limited, since the previous section

Check out this Cassandra 2014 SF Summit presentation by DataStax MVP Robbie Strickland called " CQL Under the Hood ." Slides 62-64 show that the full key of the section is used as a string. With composite partition keys in Cassandra, you must query the entire rowkey row or nothing.

You can watch the full video with the presentation here .

+12
source share

This is not possible in Cassandra because resolving such a query will require a full table scan. The location of the partition is determined by the hash of all members of the composite key, which means that providing only half of the key also does not give anything. The only way to find the entry is to find all the keys and check if they match.

+4
source share