1
votes

I have a table that contains words with their frequencies in Cassandra table(word, frequenc0y, frequency1).
Can I make the primary key consisting of only word as Partition key? if not, can I use word also as Clustering key?

1
What queries do you want to perform? You can make word as single key, and then you'll be able to retrieve the frequency for the given word.flavian

1 Answers

2
votes

You have no constraints, except that you cannot reuse your columns, so you can put only a single column in your PRIMARY KEY definition, that will specifically be your PARTITION KEY.

BTW, if that's all you need, and depending on your UPDATE capabilities on the frequency0 and frequency1 columns, that could be a job for counter columns. Have a look at the official documentation about counters:

HTH.