@@ -102,50 +102,62 @@ ENGINE = Distributed('oximeter_cluster', 'oximeter', 'measurements_cumulativef64
102
102
* already has the key. Realistically though, these tables are quite small and
103
103
* so performance benefits will be low in absolute terms.
104
104
*/
105
- CREATE TABLE IF NOT EXISTS oximeter .fields_i64 ON CLUSTER oximeter_cluster
105
+ CREATE TABLE IF NOT EXISTS oximeter .fields_i64_local ON CLUSTER oximeter_cluster
106
106
(
107
107
timeseries_name String,
108
108
timeseries_key UInt64,
109
109
field_name String,
110
110
field_value Int64
111
111
)
112
- ENGINE = ReplicatedReplacingMergeTree(' /clickhouse/tables/{shard}/fields_i64 ' , ' {replica}' )
112
+ ENGINE = ReplicatedReplacingMergeTree(' /clickhouse/tables/{shard}/fields_i64_local ' , ' {replica}' )
113
113
ORDER BY (timeseries_name, field_name, field_value, timeseries_key);
114
114
115
- CREATE TABLE IF NOT EXISTS oximeter .fields_ipaddr ON CLUSTER oximeter_cluster
115
+ CREATE TABLE IF NOT EXISTS oximeter .fields_i64 ON CLUSTER oximeter_cluster AS oximeter .fields_i64_local
116
+ ENGINE = Distributed(' oximeter_cluster' , ' oximeter' , ' fields_i64_local' , xxHash64(splitByChar(' :' , timeseries_name)[1 ]));
117
+
118
+ CREATE TABLE IF NOT EXISTS oximeter .fields_ipaddr_local ON CLUSTER oximeter_cluster
116
119
(
117
120
timeseries_name String,
118
121
timeseries_key UInt64,
119
122
field_name String,
120
123
field_value IPv6
121
124
)
122
- ENGINE = ReplicatedReplacingMergeTree(' /clickhouse/tables/{shard}/fields_ipaddr ' , ' {replica}' )
125
+ ENGINE = ReplicatedReplacingMergeTree(' /clickhouse/tables/{shard}/fields_ipaddr_local ' , ' {replica}' )
123
126
ORDER BY (timeseries_name, field_name, field_value, timeseries_key);
124
127
125
- CREATE TABLE IF NOT EXISTS oximeter .fields_string ON CLUSTER oximeter_cluster
128
+ CREATE TABLE IF NOT EXISTS oximeter .fields_ipaddr ON CLUSTER oximeter_cluster AS oximeter .fields_ipaddr_local
129
+ ENGINE = Distributed(' oximeter_cluster' , ' oximeter' , ' fields_ipaddr_local' , xxHash64(splitByChar(' :' , timeseries_name)[1 ]));
130
+
131
+ CREATE TABLE IF NOT EXISTS oximeter .fields_string_local ON CLUSTER oximeter_cluster
126
132
(
127
133
timeseries_name String,
128
134
timeseries_key UInt64,
129
135
field_name String,
130
136
field_value String
131
137
)
132
- ENGINE = ReplicatedReplacingMergeTree(' /clickhouse/tables/{shard}/fields_string ' , ' {replica}' )
138
+ ENGINE = ReplicatedReplacingMergeTree(' /clickhouse/tables/{shard}/fields_string_local ' , ' {replica}' )
133
139
ORDER BY (timeseries_name, field_name, field_value, timeseries_key);
134
140
135
- CREATE TABLE IF NOT EXISTS oximeter .fields_uuid ON CLUSTER oximeter_cluster
141
+ CREATE TABLE IF NOT EXISTS oximeter .fields_string ON CLUSTER oximeter_cluster AS oximeter .fields_string_local
142
+ ENGINE = Distributed(' oximeter_cluster' , ' oximeter' , ' fields_string_local' , xxHash64(splitByChar(' :' , timeseries_name)[1 ]));
143
+
144
+ CREATE TABLE IF NOT EXISTS oximeter .fields_uuid_local ON CLUSTER oximeter_cluster
136
145
(
137
146
timeseries_name String,
138
147
timeseries_key UInt64,
139
148
field_name String,
140
149
field_value UUID
141
150
)
142
- ENGINE = ReplicatedReplacingMergeTree(' /clickhouse/tables/{shard}/fields_uuid ' , ' {replica}' )
151
+ ENGINE = ReplicatedReplacingMergeTree(' /clickhouse/tables/{shard}/fields_uuid_local ' , ' {replica}' )
143
152
ORDER BY (timeseries_name, field_name, field_value, timeseries_key);
144
153
154
+ CREATE TABLE IF NOT EXISTS oximeter .fields_uuid ON CLUSTER oximeter_cluster AS oximeter .fields_uuid_local
155
+ ENGINE = Distributed(' oximeter_cluster' , ' oximeter' , ' fields_uuid_local' , xxHash64(splitByChar(' :' , timeseries_name)[1 ]));
156
+
145
157
/* The timeseries schema table stores the extracted schema for the samples
146
158
* oximeter collects.
147
159
*/
148
- CREATE TABLE IF NOT EXISTS oximeter .timeseries_schema ON CLUSTER oximeter_cluster
160
+ CREATE TABLE IF NOT EXISTS oximeter .timeseries_schema_local ON CLUSTER oximeter_cluster
149
161
(
150
162
timeseries_name String,
151
163
fields Nested(
@@ -200,5 +212,8 @@ CREATE TABLE IF NOT EXISTS oximeter.timeseries_schema ON CLUSTER oximeter_cluste
200
212
),
201
213
created DateTime64(9 , ' UTC' )
202
214
)
203
- ENGINE = ReplicatedMergeTree(' /clickhouse/tables/{shard}/timeseries_schema ' , ' {replica}' )
215
+ ENGINE = ReplicatedMergeTree(' /clickhouse/tables/{shard}/timeseries_schema_local ' , ' {replica}' )
204
216
ORDER BY (timeseries_name, fields .name );
217
+
218
+ CREATE TABLE IF NOT EXISTS oximeter .timeseries_schema ON CLUSTER oximeter_cluster AS oximeter .timeseries_schema_local
219
+ ENGINE = Distributed(' oximeter_cluster' , ' oximeter' , ' timeseries_schema_local' , xxHash64(splitByChar(' :' , timeseries_name)[1 ]));
0 commit comments