Commit 3d48d86
Maintain materialized view data status.
A materialized view's data could be seen as up to date with
base tables if there are no writable operations since last
Refresh of the view.
If one of base tables in the query tree of a materailied view is
modified, the view data is not up to date. And we could not use
it to answer query.
This commit maintain the data satus of a materialized view and
it applies to normal materialized view, IVM with defer refresh.
IVM with immediately refresh is always up to date.
When a base table has writable operation, we try
to update view data status as:
- 'u'(up to date):
Create Materialized View
Refresh
- 'e'(expired):
Update base tables
Delete base tables
Refresh With No Data
Truncate base tables
Create Materialized View With No Data
- 'i'(insert only):
Insert info base tables
Copy From
Copy From on Segments
- 'r'(up to date but reorganized):
Cluster base tables
Vacuum Full base tables
Insert, Update, Delete, Copy From operations take effect if the
actual affected rows > 0, ex:
insert into t1 select * from t2;
We don't need to update view if t2 has zero rows.
The real status will be decided both by current and the status we
try to mark as.Ex: we try to mark insert only on a expired status,
it will not success.
This doesn't work on utility mode, if user modified data in that
mode, should refresh views if want to use it to answer query.
AQUMV could use normal materialized views after this commit.
Authored-by: Zhang Mingli avamingli@gmail.com1 parent be38ff5 commit 3d48d86
File tree
34 files changed
+1700
-12
lines changed- gpMgmt/bin
- gppylib
- src
- backend
- catalog
- commands
- executor
- utils/cache
- include
- catalog
- cdb
- utils
- test
- regress
- expected
- sql
- singlenode_regress
- expected
- sql
34 files changed
+1700
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1283 | 1283 | | |
1284 | 1284 | | |
1285 | 1285 | | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
1286 | 1290 | | |
1287 | 1291 | | |
1288 | 1292 | | |
| |||
1533 | 1537 | | |
1534 | 1538 | | |
1535 | 1539 | | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
1536 | 1544 | | |
1537 | 1545 | | |
1538 | 1546 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| 98 | + | |
| 99 | + | |
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
| |||
551 | 553 | | |
552 | 554 | | |
553 | 555 | | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
554 | 566 | | |
555 | 567 | | |
556 | 568 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| |||
209 | 210 | | |
210 | 211 | | |
211 | 212 | | |
212 | | - | |
| 213 | + | |
| 214 | + | |
213 | 215 | | |
214 | 216 | | |
215 | 217 | | |
| |||
1554 | 1556 | | |
1555 | 1557 | | |
1556 | 1558 | | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
1557 | 1563 | | |
1558 | 1564 | | |
1559 | 1565 | | |
| |||
2978 | 2984 | | |
2979 | 2985 | | |
2980 | 2986 | | |
| 2987 | + | |
| 2988 | + | |
| 2989 | + | |
2981 | 2990 | | |
2982 | 2991 | | |
2983 | 2992 | | |
| |||
0 commit comments