Changing configuration¶
update_mv() changes timing, scheduling, or watch tables for a registered view. Parameters you do not supply keep their current values.
-- Change just the timing
SELECT pgauto_mv.update_mv(
p_mv_schema => 'reporting',
p_mv_name => 'daily_revenue',
p_refresh_lag => 30.0,
p_cooldown => 60.0
);
-- Replace the watch tables (removes old triggers and installs new ones)
SELECT pgauto_mv.update_mv(
p_mv_schema => 'reporting',
p_mv_name => 'daily_revenue',
p_watch_tables => ARRAY[
pgauto_mv.mv_watch('sales.orders', 'INSERT,UPDATE'),
pgauto_mv.mv_watch('sales.adjustments', 'INSERT')
]
);
-- Check base tables before deciding what to watch
SELECT schema_name, table_name
FROM pgauto_mv.get_view_tables('reporting', 'daily_revenue');