Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a couple of postgres 8.3 databases, and they are showing symptoms of lack of vacuuming.

I've checked the config, and they are in the default state of having the autovacummer turned on. Also, I see in my postgres logs "autovacuum launcher started" when I start the database.

The problem is, I never actually see a vacuum running. I also never see anything in the logs about a vacuum taking place (should I be seeing anything?)

So how do I tell if the vacuumer is working? Is there a way to see when the last vacuum completed, for example? Better yet, is there some documentation someone can point me to with the answer to that question?

Thanks!

share|improve this question

3 Answers 3

up vote 7 down vote accepted

pg_stat_user_tables has columns *last_autovacuum* and *last_autoanalyze*. They will be updated whenever it does something.

share|improve this answer
    
Awesome, that was exactly what I was looking for! Incidentally, everything is being vacuumed as expected. –  jedberg Aug 12 '09 at 22:58

At a higher level, PgSnap is your friend ;-)

Here is un example of last vaccuum report

share|improve this answer

Google is your friend, and www.postgresql.org even greater:

18.9. Automatic Vacuuming

log_autovacuum_min_duration (integer)

Causes each action executed by autovacuum to be logged if it ran for at least the specified number of milliseconds. Setting this to zero logs all autovacuum actions. Minus-one (the default) disables logging autovacuum actions. For example, if you set this to 250ms then all automatic vacuums and analyzes that run 250ms or longer will be logged. Enabling this parameter can be helpful in tracking autovacuum activity. This setting can only be set in the postgresql.conf file or on the server command line.

share|improve this answer
    
Thanks! That is the doc for postgres 8.4, but it appears to apply to 8.3 as well. The only reason I didn't accept your answer is because I didn't have to restart with Magnus's answer, but it they let me, I would have accepted your answer too. :) –  jedberg Aug 12 '09 at 22:59
    
No problem :) It was anyway easy to find in the docs :) –  slovon Aug 13 '09 at 20:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.