1.全量表
(1)全量表,有无变化,都要报
(2)每次上报的数据都是所有的数据(变化的 + 没有变化的)
(3) 每天抽取
第一次:
id | name | money | time |
1 | a | 10 | 2020-05-18 00:01:01 |
2 | b | 20 | 2020-05-18 10:00:00 |
第二次:
id | name | money | time |
1 | a | 20 | 2020-05-19 00:01:01 |
2 | b | 20 | 2020-05-18 10:00:00 |
3 | c | 10 | 2020-05-19 00:01:01 |
分别抽数两次对应全量表
id | name | money | time | dt |
1 | a | 10 | 2020-05-18 00:01:01 | 2020-05-18 |
2 | b | 20 | 2020-05-18 10:00:00 | 2020-05-18 |
id | name | money | time | dt |
1 | a | 20 | 2020-05-19 00:01:01 | 2020-05-19 |
2 | b | 20 | 2020-05-18 10:00:00 | 2020-05-19 |
3 | c | 10 | 2020-05-19 00:01:01 | 2020-05-19 |
2.增量表:只要更新(新增、修改)就同步
第一次:
id | name | money | time |
1 | a | 10 | 2020-05-18 00:01:01 |
2 | b | 20 | 2020-05-18 10:00:00 |
第二次:
id | name | money | time |
1 | a | 20 | 2020-05-19 00:01:01 |
2 | b | 20 | 2020-05-18 10:00:00 |
3 | c | 10 | 2020-05-19 00:01:01 |
对应两次抽数增量表(需要监控表的改变)
id | name | money | time | dt |
1 | a | 10 | 2020-05-18 00:01:01 | 2020-05-18 |
2 | b | 20 | 2020-05-18 10:00:00 | 2020-05-18 |
id | name | money | time | dt |
1 | a | 20 | 2020-05-19 00:01:01 | 2020-05-19 |
3 | c | 10 | 2020-05-19 00:01:01 | 2020-05-19 |
3.拉链表:
(1)不需要像全量表,每天抽取所有数据(节省空间)
(2)可以查看某条记录的历史状态
第一次:
id | name | money | time |
1 | a | 10 | 2020-05-18 00:01:01 |
2 | b | 20 | 2020-05-18 10:00:00 |
第二次:
id | name | money | time |
1 | a | 20 | 2020-05-19 00:01:01 |
2 | b | 20 | 2020-05-18 10:00:00 |
3 | c | 10 | 2020-05-19 00:01:01 |
对应的拉链表
id | name | money | time | t_start | t_end |
1 | a | 10 | 2020-05-18 00:01:01 | 2020-05-18 | 9999-12-31 |
2 | b | 20 | 2020-05-18 10:00:00 | 2020-05-18 | 9999-12-31 |
id | name | money | time | t_start | t_end |
1 | a | 10 | 2020-05-18 00:01:01 | 2020-05-18 | 2020-05-18 |
1 | a | 20 | 2020-05-19 00:01:01 | 2020-05-19 | 9999-12-31 |
2 | b | 20 | 2020-05-18 10:00:00 | 2020-05-18 | 9999-12-31 |
3 | c | 10 | 2020-05-19 00:01:01 | 2020-05-19 | 9999-12-31 |