Thread: Autvacuum and Analyze stats?

Autvacuum and Analyze stats?

From
"Machiel Richards"
Date:

Hi All

 

     I have a couple of databases on which the autovacuum is configured.

 

                Is there a way to confirm when last the autovacuum ran (and if so was there any errors).

 

                                                *** The auto vacuum is configured to run every 60 seconds, however the check_postgres package states that the last vacuum was 12 days ago and I need to see if I can confirm this manually.

 

                I am also trying to find out if there is a way of seeing when last a table / database had been analyzed if ever.

 

 

   I hope someone can assist (or understand what I am looking for though J    )

 

 

Regards

Machiel

 

Re: Autvacuum and Analyze stats?

From
Devrim GÜNDÜZ
Date:
On Tue, 2010-04-13 at 12:03 +0200, Machiel Richards wrote:

>  Is there a way to confirm when last the autovacuum ran

Check pg_stat_user_tables (or pg_stat_{all,sys,user}_tables. They
include autovacuum info.

> (and if so was there any errors).

If you are running 8.3+, you may enable autovacum logging by setting
log_autovacuum_min_duration to 0, and check for any issues.

> The auto vacuum is configured to run every 60 seconds, however the
> check_postgres package states that the last vacuum was 12 days ago and
> I need to see if I can confirm this manually.

autovacuum updates last_autovacuum (and last_autoanalyze) columns. The
columns you mention are last_vacuum (and last_analyze), and they are
updated when manual vacuum is run. So you are using last_vacuum
parameter. You may also want to use last_autovacuum parameter of
check_postgres.

> I am also trying to find out if there is a way of seeing
> when last a table / database had been analyzed if ever.

See above (pg_stat_user_tables)

-HTH.
--
Devrim GÜNDÜZ
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
PostgreSQL RPM Repository: http://yum.pgrpms.org
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org  Twitter: http://twitter.com/devrimgunduz

Attachment