AP
Size: a a a
AP
SA
DC
АФ
S
SG
A
IY
8S
select count(*) from $table WHERE CityID = '15b9f91c-f775-11e7-80a7-00155d03330d'Без использования индекса
┌─count()─┐
│ 368688 │
└─────────┘
select count(*) from $table WHERE toString(CityID) = '15b9f91c-f775-11e7-80a7-00155d03330d'Гранулярность по дефолту 8192
┌──count()─┐
│ 26781483 │
└──────────┘
8S
Key condition: (column 0 in ['15b9f91c-f775-11e7-80a7-00155d03330d', '15b9f91c-f775-11e7-80a7-00155d03330d'])
Reading approx. 606208 rows
m
И
m
m
CREATE MATERIALIZED VIEW child
(
`appId` UInt32,
`event` UInt8,
`count` AggregateFunction(count, String),
`uniq` AggregateFunction(uniq, String),
`priceId` UInt32,
`date` Date
)
ENGINE = AggregatingMergeTree(date, (appId, event, priceId), 8192)
AS
SELECT appId, event, countState(uidId) AS count, uniqState(uidId) AS uniq, priceId, date
FROM parent_merge_tree
GROUP BY appId, event, priceId, date;
M
DT
M