Обсуждение: pg_stat: last vacuum and analyze times are not being updated - v8.3.5

Поиск
Список
Период
Сортировка

pg_stat: last vacuum and analyze times are not being updated - v8.3.5

От
"Steve Jones"
Дата:

PostgreSQL Version:       8.3.5

OS Version:                        FreeBSD 7.0 i386

 

Issue:                                    the last_vacuum column is not being updated following a manual vacuum against a table or database.  This was highlighted recently when I configured the check_postgresql.pl script to be used from NAGIOS. 

 

Background:

Drilling down through the pg_stat_all_tables view, the underlying functions

 

·         pg_stat_get_last_vacuum_time(),

·         pg_stat_get_last_autovacuum_time(),

·         pg_stat_get_last_analyze_time() and

·         pg_stat_get_last_autoanalyze_time()

 

are not returning anything even though I have run manual and auto vacuums against these tables recently, along with ANALYZE.

 

Whether it makes a difference, I can confirm that track_counts and track_activities are both on in postgresql.conf.   The stats collection service is also running on the server – I’ve verified this by looking at the processes on the server.

 

This is causing issues with both our monitoring and also our confidence that the autovacuum service is running as it should.  We have a standby server with identical configuration (as far as I can see) and this is correctly keeping the stats up to date.  The only difference is postgres has been running well over a year on the server with the issue.

 

Many thanks in advance,

 

Steve Jones

 

Re: pg_stat: last vacuum and analyze times are not being updated - v8.3.5

От
Tom Lane
Дата:
"Steve Jones" <Steve.Jones@codeweavers.net> writes:
> Issue:                                    the last_vacuum column is not
> being updated following a manual vacuum against a table or database.

It works for me in 8.3 ... as long as there already is a stats entry for
the table in question.  You may be running into the pre-9.0 behavior
that the vacuum time update gets thrown away if there is no pre-existing
stats entry.  If you vacuum twice, does the time of the second vacuum
show up?

http://archives.postgresql.org/pgsql-committers/2009-09/msg00062.php

            regards, tom lane

Re: pg_stat: last vacuum and analyze times are not being updated - v8.3.5

От
Tom Lane
Дата:
[ re-including the mailing list ]

"Steve Jones" <Steve.Jones@codeweavers.net> writes:
> For your information, this is what I did last night.

> Restarted the stats collector process, by issuing a kill -9 against it.
> As you said, postgres started up a new collector process immediately.  I
> tried a few vacuums and the stats still weren't being updated.

> I then restarted postgres in the hope this would help.  It didn't.

> I finally had to reboot the whole server which fixed the problem.  As
> you said, I have to run two manual vacuums before the stats are showing
> up.  This possible points a finger towards FreeBSD now?  Would
> appreciate your thoughts.

If restarting Postgres didn't fix it then the problem has to have been
at the operating system level.  I can hardly think what the problem
would have been exactly.  It's not hard to imagine something going
wrong in the kernel state for the UDP socket we use to send messages to
the stats collector process; but restarting Postgres should have torn
down that socket and created a new one.  Perhaps something wrong in
global state for all local UDP transfers?  I dunno.  But it seems like
time to call in some FreeBSD hackers.

            regards, tom lane