Cassandra partial partition key

ⅰ亾dé卋堺 提交于 2019-12-13 02:22:51

问题


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

In the example above which I got from Querying Cassandra by a partial partition key, is it possible to use condition on the 1st partition key and select all condition on 2nd partition key?

Example cql statement may look like this:

select * from footable where column1 = 'name' and column2 ALL;

Is there some sort of querying like this in Cassandra?


回答1:


is it possible to use condition on the 1st partition key and select all condition on 2nd partition key?

No. To support that query, (in your table definition) you would have to modify the PRIMARY KEY to only use only column1 as the partition key, and designate column2 as a clustering key:

PRIMARY KEY ((column1), column2)

Then this query would return your desired results:

select * from footable where column1 = 'name';


来源:https://stackoverflow.com/questions/29654067/cassandra-partial-partition-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!