Skip to content

Inaccuracies in monitor-vacuum-analyze.md (VACUUM wording, last-analyzed query, autovacuum-status label) #118

Description

@tuco5

What happened

Three small inaccuracies in skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md:

1. VACUUM description overstates what plain VACUUM does

Outdated statistics cause the query planner to make poor decisions. VACUUM reclaims space, ANALYZE updates statistics.

Plain VACUUM marks dead tuples reusable within the relation — it does not necessarily return disk space to the OS (that is VACUUM FULL). "reclaims space" reads as the latter.

2. "Last analyzed" query can surface a stale timestamp

select
  relname, last_vacuum, last_autovacuum, last_analyze, last_autoanalyze
from pg_stat_user_tables
order by last_analyze nulls first;

Reading/ordering by last_analyze alone can show an older manual ANALYZE even when autovacuum analyzed the table more recently. greatest(last_analyze, last_autoanalyze) reflects the actual most-recent analyze.

3. Mislabeled autovacuum "status" check

-- Check autovacuum status
select * from pg_stat_progress_vacuum;

pg_stat_progress_vacuum only reports currently-running VACUUM/autovacuum workers — it is empty when nothing is running, so it does not describe overall autovacuum status.

Source

File: skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md

Sections: intro sentence; the "Check when tables were last analyzed" query; the "Check autovacuum status" snippet.

Fix suggestion

Reword the intro to "VACUUM reclaims dead tuples and makes space reusable", switch the query to greatest(last_analyze, last_autoanalyze) in the select list and ordering, and relabel the last snippet as a live vacuum/autovacuum activity check. PR follows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions