At least in Cassandra 1.2 this is possible, but by default it is disabled,
If you try to do this:
SELECT * from playlist where type = 'sometype' and name = 'somename';
You will get this error:
Bad Request: Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING
Then you can enable it:
SELECT * from playlist where type = 'sometype' and name = 'somename' ALLOW FILTERING;
In your example, Cassandra will allow you to execute queries using a complete subset of the primary key from left to right, for example:
SELECT * from playlist where id = 'someid'; (ALLOWED) SELECT * from playlist where id = 'someid' and type = 'sometype'; (ALLOWED) SELECT * from playlist where id = 'someid' and type = 'sometype' and name = 'somename'; (ALLOWED) SELECT * from playlist where id = 'someid' and type = 'sometype' and name = 'somename' and size=somesize; (ALLOWED)
Hope this helps
source share