I'm using Cassandra to save word and its frequency.
The table schema will be like
CREATE TABLE keywords_rate (
some_id int,
keyword Text,
frequency counter,
PRIMARY KEY (some_id, keyword)
);
The problem is, I have millions of records and I need to get the top 100 keywords for each some_id
but to do this, I need to get all keywords for given some_id and sort them on the backend (python), then get the first 100 records. which is a very costly operation for me.
So my question is: can I sort the counter inside Cassandra? and if not, what is the best approach to this scenario?
Thanks.