-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema_3_multi_table_with_statics.cql
40 lines (34 loc) · 1.18 KB
/
schema_3_multi_table_with_statics.cql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
drop table if exists monasca.measurements;
drop table if exists monasca.metrics_by_name_dimensions;
drop table if exists monasca.metrics_by_bucket_timestamp;
create table monasca.measurements (
bucket_start timestamp,
metric_id blob,
time_stamp timestamp,
value float,
value_meta text,
primary key ((bucket_start, metric_id), time_stamp)
);
create table monasca.metrics_by_name_dimensions (
tenant_id text,
region text,
bucket_start timestamp,
metric_id blob,
metric_name text,
dimension_keys_values text,
primary key ((tenant_id, region, bucket_start), metric_id)
);
CREATE CUSTOM INDEX metrics_dimensions_index ON metrics_by_name_dimensions (dimension_keys_values)
USING 'org.apache.cassandra.index.sasi.SASIIndex'
WITH OPTIONS = {'mode': 'CONTAINS'};
CREATE CUSTOM INDEX metrics_names_index ON metrics_by_name_dimensions (metric_name)
USING 'org.apache.cassandra.index.sasi.SASIIndex'
WITH OPTIONS = {'mode': 'CONTAINS'};
create table monasca.metrics_by_bucket_timestamp (
tenant_id text,
region text,
bucket_start timestamp,
metric_id blob,
time_stamp timestamp,
primary key ((tenant_id, region, bucket_start), time_stamp, metric_id)
);