基表和异步物化视图数据不一致,有个分区还未refresh,我设置 grace_priod=1,开启透明查询的结果和不开启透明查询结果不一致(开始未设置grace_priod,结果一样)
基表分区
物化视图分区
开启透明查询结果(结果错误,少了2024-04-14分区的数据)
未开启透明查询结果(结果正确)
物化视图创建SQL(olap表join MySQL表)
CREATE MATERIALIZED VIEW mv_unique_part
BUILD IMMEDIATE
REFRESH auto
ON SCHEDULE EVERY 1 day
partition by(collect_date)
DISTRIBUTED BY hash(room_id) BUCKETS auto
PROPERTIES (
"replication_num" = "1"
)
AS SELECT
a.collect_date,
a.room_id,
a.item_code,
a.target_code,
a.collect_ts,
a.collect_minute,
a.target_group,
a.tag_value,
b.item_name,
b.room_name
FROM
imp_base_target_unique_part a
join m_d.imp_db.v_imp_base_target b
on a.room_id = b.room_id
and a.item_code = b.item_code
and a.target_code = b.target_code;