1
1
8
CREATE TABLE perf_avg(
num UInt64,
num_u Decimal256(75) MATERIALIZED toDecimal256(num / 400000, 75),
num_f Float64 MATERIALIZED num / 100
) ENGINE = MergeTree() ORDER BY num
INSERT INTO perf_avg(num)
SELECT toUInt64(UserID / (WatchID + 1) * 1000000)
FROM hits_100m_single
LIMIT 50000000
optimize table perf_avg final
SELECT avg(num) FROM perf_avg FORMAT Null
SELECT avg(2 * num) FROM perf_avg FORMAT Null
SELECT avg(num_u) FROM perf_avg FORMAT Null
SELECT avg(num_f) FROM perf_avg FORMAT Null
SELECT avgWeighted(num_f, num) FROM perf_avg FORMAT Null
SELECT avgWeighted(num_f, num_f) FROM perf_avg FORMAT Null
SELECT avgWeighted(num_f, num_f) FROM perf_avg FORMAT Null
SELECT avgWeighted(toNullable(num_f), num_f) FROM perf_avg FORMAT Null
SELECT avgWeighted(num_f, toNullable(num_f)) FROM perf_avg FORMAT Null
SELECT avgWeighted(toNullable(num_f), toNullable(num_f)) FROM perf_avg FORMAT Null
SELECT avgWeightedIf(num_f, num_f, num % 10) FROM perf_avg FORMAT Null
SELECT avgWeightedIf(toNullable(num_f), num_f, num % 10) FROM perf_avg FORMAT Null
SELECT avgWeightedIf(num_f, toNullable(num_f), num % 10) FROM perf_avg FORMAT Null
SELECT avgWeightedIf(toNullable(num_f), toNullable(num_f), num % 10) FROM perf_avg FORMAT Null
SELECT avgWeightedIf(num_f, num_f, toNullable(num) % 10) FROM perf_avg FORMAT Null
SELECT avgWeightedIf(toNullable(num_f), num_f, toNullable(num) % 10) FROM perf_avg FORMAT Null
SELECT avgWeightedIf(num_f, toNullable(num_f), toNullable(num) % 10) FROM perf_avg FORMAT Null
SELECT avgWeightedIf(toNullable(num_f), toNullable(num_f), toNullable(num) % 10) FROM perf_avg FORMAT Null
DROP TABLE IF EXISTS perf_avg