I am new to Casssandra and I feel difficult to implement the datamodel.
I have faced lot of issue to design a single table.
Before i mention the table definition i want to show you the ways we have to retrieve and update record
select * from email where username='suresh' and inactive='N' and type='outbound'
order by insert_ts desc allow filtering;
update email set inactive='Y' where username='suresh' and inactive='N'
and id=101;
To create a table i should follow all cassandra defined rules. I am facing the problem while creating the indexes for the table
If i create primary key like this
PRIMARY KEY(username, inactive,type,insert_ts);
I am able to retrieve record but when i do update, i am getting error saying "Primary key part found in set" error.
If i create primary key and secondary key like below
PRIMARY KEY(username, type,insert_ts);
Secondary index = inactive;
I am able to do update but when i retrieve, I am getting error saying "Secondary index will not be allowed with order by clause"
I have created email table using cql like
Create table email(id int, username varchar, comment text,
inactive boolean, insert_ts timestamp, type varchar,
PRIMARY KEY(<<some columns yet to decide>>));
Please suggest me how to create email table which satisfy my queries.