Re: Is the database being VACUUMed?

From: Chris Browne <cbbrowne(at)acm(dot)org>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Is the database being VACUUMed?
Date: 2006-02-10 20:17:57
Message-ID: 6064nneznu.fsf@dba2.int.libertyrms.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

benny(at)bennyvision(dot)com ("C. Bensend") writes:
> Hey folks,
>
> I'm running 8.0.4 on OpenBSD, and I'm running into issues where
> a large batch job will fire up and occasionally coincide with a
> VACUUM. Which then makes this batch take an hour and a half,
> rather than the 30 minutes it usually takes. :(
>
> I am going to upgrade to 8.1.2 this weekend, before you ask. :)
>
> Here's the question - is there a query I can make in my scripts
> (using perl/DBD::Pg) to see if the database is being VACUUMed at
> the current time? I could add a sleep, so the script would
> patiently wait for the VACUUM to finish before kicking off several
> intense queries.
>
> Thanks much!

If you have command string monitoring turned on, via
stats_command_string in the postgresql.conf file, then you could get
this information from the system view pg_stat_activity.

Generally, you could look to see if a current_query is a vacuum, perhaps via...

select * from pg_stat_activity where lower(current_query) like 'vacuum%' ;

If that parameter is not turned on, then ps auxww | egrep [something
finding your PG processes] | grep VACUUM could perhaps do the trick,
albeit not from a straightforward database query...
--
output = ("cbbrowne" "@" "acm.org")
http://www.ntlug.org/~cbbrowne/advocacy.html
"Is your pencil Y2K certified? Do you know the possible effects if it
isn't?"

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message david drummard 2006-02-10 20:41:04 performance question related to pgsql
Previous Message Scott Marlowe 2006-02-10 16:16:46 Re: Postgresql performance and tuning questions