I have the following table:
CREATE TABLE tab ( userID varchar, grpID varchar, itemID varchar, timestamp bigint, PRIMARY KEY());
I need to execute the following queries on this table, where:
- userID = x
- userID = x and grpID = y
- userID = x and grpID IN (a,b,c)
Also, the results should be sorted by timestamp field in descending order, which makes timestamp as my clustering key.
I want to avoid duplication of data or creating same table with 2 primary keys to achieve my queries.
What should be my primary key now so that I should be able to execute all these queries?