Skip to content

Checking what is happening

Current status of all registered views

SELECT
    mv_schema,
    mv_name,
    is_pending,
    refresh_due_at,
    last_refresh_completed,
    duration_ms,
    cooldown_until
FROM pgauto_mv.get_mv_status();
Column What it tells you
is_pending true — a change was detected and a refresh is queued or about to fire.
refresh_due_at When the refresh will next run (if pending).
last_refresh_completed When the most recent successful refresh finished.
duration_ms How long the last refresh took in milliseconds.
cooldown_until Earliest time the next refresh can start.

The event log

Every time data changes in a watch table, pg_auto_mv writes a record:

SELECT
    event_at,
    watch_schema,
    watch_table,
    operation,
    action
FROM pgauto_mv.mv_events
JOIN pgauto_mv.materialised_views USING (auto_mv_id)
WHERE mv_schema = 'reporting' AND mv_name = 'daily_revenue'
ORDER BY event_at DESC
LIMIT 20;

The action column shows how this event fits into the refresh cycle: - 'opened' — this is the first change in a new pending window. A refresh cycle has begun. - 'updated' — another change arrived while a refresh is already pending. The debounce timer was reset. - 'direct' — the event came from a refresh_materialised_view_now() call, not a table change.

The refresh log

Every refresh attempt (successful, failed, or skipped) produces a record:

SELECT
    refresh_started,
    refresh_completed,
    duration_ms,
    success,
    error_message,
    skip_reason,
    refresh_source
FROM pgauto_mv.mv_refresh_log
JOIN pgauto_mv.materialised_views USING (auto_mv_id)
WHERE mv_schema = 'reporting' AND mv_name = 'daily_revenue'
ORDER BY refresh_id DESC
LIMIT 10;
success skip_reason What happened
true NULL Refresh ran and completed.
true 'in_cooldown' A scheduled slot fired but the view was in its cooldown window — skipped deliberately.
true 'inactive' The registration is paused — skipped deliberately.
false Refresh failed. Check error_message. A retry is automatically scheduled.

Full detail for one view

SELECT * FROM pgauto_mv.get_mv('daily_revenue', 'reporting');

Returns a single row with every configuration field, current state as a JSON object, and watch tables as a JSON array. Useful for confirming the configuration before making changes.