版本:Apache Doris v2.1.5
异步物化视图创建语句:
CREATE MATERIALIZED VIEW mv_order_business_view BUILD IMMEDIATE REFRESH ON MANUAL DISTRIBUTED BY RANDOM BUCKETS 10 AS
SELECT
O.order_no
FROM
order_poc_b O
JOIN dwd_member_mi H ON O.member_code = H.member_code;
验证代码:
SELECT COUNT(*) AS order_qty
FROM order_poc_a O
INNER JOIN dwd_member_mi H ON O.member_code = H.member_code
WHERE O.order_no NOT IN (SELECT order_no
FROM mv_order_business_view O)
order_qty大于0
order_poc_a为order_poc_b的参照组,表结构及数据一模一样,避免透明改写的影响。
order_poc_b的数据量为十万+,异步物化视图中的数据量少了近三分之一。
已排除Base Table与视图之前不同步的影响,还有什么其他原因会导致数据不一致数据丢失?