I am modeling my desk for Cassandra 3.0+. The goal is to create a table that stores user actions, here is what I have done so far: (user id from another Mysql database)
CREATE TABLE activity (
userid int,
type int,
remoteid text,
time timestamp,
imported timestamp,
visibility int,
title text,
description text,
img text,
customfields MAP<text,text>,
PRIMARY KEY (userid, type, remoteid, time, imported))
These are the main queries I use:
SELECT * FROM activity WHERE userid = ? AND remoteid = ?;
SELECT * FROM activity WHERE userid = ? AND type = ? AND LIMIT 10;
Now I need to add a column visibilityto the second query. So, from what I learned, I can choose between a secondary index or a materialized view. Here are the facts:
- Here I have one section per user and inside there are thousands of lines (actions).
- I always use the section key (userid) in my entire request to access data.
- the global number of events is 30 million, is growing. Column
visibility ( 3 ) , .
? ? , - , , , , .