Using Cassandra for Time Series Data

I am in my research for magazine storage in Kassandra.
The layout for magazines will be something like this.

EDIT: I changed the circuit to provide some clarification.

CREATE TABLE log_date (
  userid bigint,
  time timeuuid,
  reason text,
  item text,
  price int,
  count int,
  PRIMARY KEY ((userid), time) - #1
  PRIMARY KEY ((userid), time, reason, item, price, count) - #2
);

A new table will be created for the daily day. Thus, the table only contains logs for one day.

My query condition is as follows. Request all logs from a specific user on a specific day (date not time).
Thus, the reason, element, price, invoice will not be used as hints or conditions for requests in general.

My question is which PRIMARY KEY design works best.
EDIT: And the key here is that I want to store the logs in a schematic form.

# 1, . . , , . , subreason, friendid ..

# 2, () , .

? , .

+2
1

, , , , .

uuids , :

CREATE TABLE log_per_day (
   userid bigint,
   date text, 
   time timeuuid, 
   value text,
      PRIMARY KEY ((userid, date), time)
)

.

time, , , .

, composite key , .

insert into log_per_day (userid, date, time, value) values (1000,'2015-05-06',aTimeUUID1,'my value')

insert into log_per_day (userid, date, time, value) values (1000,'2015-05-06',aTimeUUID2,'my value2')

, .

, , Time Series

, ,

+16

Source: https://habr.com/ru/post/1661554/


All Articles