1.数据量的比对 select count(*)
2.数据内容全字段的比对,难度比较大。
MySQL–》数据仓库
full join结果作为 t表
补数据: select * from t where bid is null 拿到a表字段的数据 拼接sql插入数据仓库
删数据: select * from t where aid is null --> bid --delete 语句
3.什么时候做数据比对
根据你的业务周期来决定
先做一次全量的修复
当前时间为:2019-06-29
做<2019-06-01 00:00:00 以前的全量
mysql:select count(1) from a where cretime<'2019-06-01 00:00:00'
数据仓库:select count(1) from b where cretime<'2019-06-01 00:00:00'
然后做增量的比对
select count(1) from a where
cretime>='2019-06-14 00:00:00' and cretime<'2019-06-29 00:00:00' ;
4.复盘
每月做一次全量的, 根据当前时间减去一个月。