【发布时间】:2021-11-16 23:55:54
【问题描述】:
我已经使用这个查询创建了一个物化视图
CREATE MATERIALIZED VIEW db.top_ids_mv (
`date_time` DateTime,
`id` String,
`total` UInt64
) ENGINE = SummingMergeTree
ORDER BY
(date_time, id) SETTINGS index_granularity = 8192 POPULATE AS
SELECT
toDateTime((intDiv(toUInt32(date_time), 60 * 60) * 60) * 60) AS date_time,
id AS id,
count(*) AS count
FROM
db.table
WHERE
type = 'user'
GROUP BY
date_time,id
我的表包含近 180 亿条记录。我使用POPULATE 插入了我的旧数据。但是新插入的数据并没有插入到这个物化视图中。我创建了许多其他视图,它们工作正常,但这会产生问题。
这是我在日志中收到的内容
2021.09.23 19:54:54.424457 [ 137949 ] {5b0f3c32-2900-4ce4-996d-b9696bd38568} <Trace> PushingToViewsBlockOutputStream: Pushing (sequentially) from db.table (15229c91-c202-4809-9522-9c91c2028809) to db.top_ids_mv (0cedb783-bf17-42eb-8ced-b783bf1742eb) took 0 ms.
我注意到的一件事是它需要 0 毫秒。我认为这是错误的,因为查询必须花费一些时间。
谢谢。任何帮助将不胜感激
【问题讨论】:
标签: database clickhouse clickhouse-client