Column reference: get_mv() and list_mv()¶
Both functions return the same columns. list_mv() adds a leading status column.
pgauto_mv.get_mv(p_mv_name, p_mv_schema, p_mv_oid)¶
At least one of p_mv_name or p_mv_oid must be supplied. Name/schema matching is case-insensitive. Returns 0 rows when not found — no exception is raised.
| Column | Type | Description |
|---|---|---|
auto_mv_id |
uuid |
Unique identifier for this registration. |
mv_schema |
text |
Schema of the materialised view. |
mv_name |
text |
Name of the materialised view. |
concurrent |
boolean |
Whether REFRESH MATERIALIZED VIEW CONCURRENTLY is configured. |
can_build_concurrently |
boolean |
Whether the last concurrent refresh succeeded. NULL = no concurrent refresh attempted yet. |
refresh_lag |
float8 |
Seconds after the latest change before a refresh is due. |
max_wait |
float8 |
Maximum seconds from the first change before a refresh is forced. 0 = no cap. |
cooldown |
float8 |
Minimum seconds between refresh completions. |
fire_on_replica |
boolean |
true = triggers also respond to writes arriving via logical replication. Required for multi-master. |
is_active |
boolean |
false = paused; events are recorded but no refresh runs. |
schedule_name |
text |
Name of the attached schedule. NULL when no schedule is attached. |
schedule_kind |
text |
'time' or 'interval'. NULL when no schedule is attached. |
created_at |
timestamptz |
When this registration was created. |
created_by |
text |
Role that called register_mv(). |
is_populated |
boolean |
Whether the view has been populated with data. |
watch_tables |
jsonb |
Array of watch table objects, each with watch_schema, watch_table, watch_insert, watch_update, watch_delete. |
schedule |
jsonb |
Schedule definition (kind, interval, day/time rows). NULL when no schedule. |
state |
jsonb |
Current operational state — see below. |
state JSON fields:
| Field | Description |
|---|---|
is_pending |
true when a change has been detected and a refresh has not yet run for it. |
first_event_at |
When the first change in the current pending window was detected. |
latest_event_at |
When the most recent change was detected. |
last_refresh_started |
When the most recent refresh attempt started. Non-null while a refresh is in progress. |
last_refresh_completed |
When the most recent successful refresh completed. |
last_watch_schema |
Schema of the table that triggered the last change. |
last_watch_table |
Table that triggered the last change. |
next_scheduled_at |
Next scheduled refresh slot. null if no schedule is attached. |
refresh_source |
What triggered the current pending window: 'event', 'chain', or 'direct'. |
cooldown_until |
Earliest time the next refresh can start. |
refresh_due_at |
When the next refresh is due, accounting for timing and cooldown. When refresh_source = 'direct', this reflects the bypass override. |
pgauto_mv.list_mv(p_schema, p_status, p_include_missing)¶
Returns zero or more rows. All columns are identical to get_mv() plus a leading status column.
| Parameter | Default | Description |
|---|---|---|
p_schema |
NULL |
Filter by schema. NULL = all schemas. |
p_status |
'all' |
'ok' = registered views that still exist; 'invalid' = registered views whose underlying view was dropped without unregistering; 'missing' = views in the database not registered with pg_auto_mv; 'all' = all of the above. |
p_include_missing |
false |
When true, also returns unregistered views with status = 'missing'. Automatically set to true when p_status = 'missing'. |
status value |
Meaning |
|---|---|
'ok' |
Registered and the view still exists in the database. |
'invalid' |
Registered but the view was dropped without calling unregister_mv(). |
'missing' |
The view exists in the database but is not registered with pg_auto_mv. |
For 'missing' rows, only status, mv_schema, mv_name, and is_populated are populated; all other columns are NULL.
For installation, security configuration, multi-master deployment, and maintenance operations (trigger rebuild, catalog sync), see DBA_GUIDE.md.