Open yugo-n opened 4 years ago
Implementation idea notes:
When switching IMMV -> MV, we just have to drop or disable IVM triggers on base tables. Also pg_class.relisivm flag have to be cleared.
When MV->IMMV, we will have to refresh the view data to the up-to-date state. Therefore, maybe we should use REFRESH command instead of ALTER. Or, we can use ALTER to switch its mode and set the view non-scannable, and then use REFRESH manually to populate the view.
When Switching IMMV -> MV, there should be a way for administrator to check if relation is IMMV or MV. Not sure that \d+ permits this (it does not, after REFRESH WITH NODATA)
When MV->IMMV, hidden columns __x__ could also be missing, and would have to be recreated.
There is the same request in pgsql-hackers.
I'll consider it again...
This feature can keep frozen data available in the materialized view during heavy operations on source tables.
Syntax ideas:
or others. Maybe it is better to use REFRESH. We will need more discussions.
Suggested by PAscal https://www.postgresql.org/message-id/1581458652080-0.post%40n3.nabble.com