How to find when Postgres tables were auto-vacuumed and auto-analyzed?

This article will show you how to determine when your database tables were last vacuumed, auto-vacuumed, analyzed, and auto-analyzed on a PostgresSQL 8.x database.

  1. Login to the PostgresSQL command-line interface
  2. psql -U [username] [database_name]

  3. Run the following query:
  4. select relname,last_vacuum, last_autovacuum, last_analyze, last_autoanalyze from pg_stat_user_tables;


Please post your comments/suggestions!