VB

нужно для
“user_id”
и ”photo_id”
посчитать последний “elo
” и количество “ts
”Size: a a a
VB
“user_id”
и ”photo_id”
посчитать последний “elo
” и количество “ts
”VB
———————————————————-——————————————
| 15322097 | 60189059 | 101 | 8 |
DC
“user_id”
и ”photo_id”
посчитать последний “elo
” и количество “ts
”CREATE TABLE ttt(
user_id, photo_id,
elo AggregateFunction(argMax, Int64, DateTime),
cnt SimpleAggregateFunction(sum, UInt64))
ENGINE = AggregatingMergeTree
PARTITION BY
ORDER BY (user_id, photo_id,);
CREATE MATERIALIZED VIEW ttt_mv TO ttt AS
SELECT
user_id, photo_id,
argMaxState(elo, ts) AS elo,
sum(toUInt64(1))
FROM states_raw
GROUP BY user_id, photo_id;
M
VB
CREATE TABLE ttt(
user_id, photo_id,
elo AggregateFunction(argMax, Int64, DateTime),
cnt SimpleAggregateFunction(sum, UInt64))
ENGINE = AggregatingMergeTree
PARTITION BY
ORDER BY (user_id, photo_id,);
CREATE MATERIALIZED VIEW ttt_mv TO ttt AS
SELECT
user_id, photo_id,
argMaxState(elo, ts) AS elo,
sum(toUInt64(1))
FROM states_raw
GROUP BY user_id, photo_id;
sum(toUInt64(1))
я countState использовалDC
sum(toUInt64(1))
я countState использовалVB
SimpleAggregateFunction(sum, UInt64))
перезапишет его, верно?DC
CREATE TABLE ttt(
user_id, photo_id,
elo AggregateFunction(argMax, Int64, DateTime),
cnt SimpleAggregateFunction(sum, UInt64))
ENGINE = AggregatingMergeTree
PARTITION BY
ORDER BY (user_id, photo_id,);
CREATE MATERIALIZED VIEW ttt_mv TO ttt AS
SELECT
user_id, photo_id,
argMaxState(elo, ts) AS elo,
sum(toUInt64(1))
FROM states_raw
GROUP BY user_id, photo_id;
AggregateFunction
SimpleAggregateFunction
sum(toUInt64(1))
то это тоже самоеM
DC
M
VB
AggregateFunction
SimpleAggregateFunction
sum(toUInt64(1))
то это тоже самоеcnt
?DC
cnt
?EV
VB
IR
MK
D
YV
MK