Search Postgresql Archives

Re: detection of VACUUM in progress

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 30, 2005 at 05:35:13PM +0200, Bohdan Linda wrote:
> 
> Is there any way how to detect running command VACUUM by reading pg_* tables?

If you have stats_command_string enabled then you could query
pg_stat_activity, but be aware that the results will be stale by
the time you see them (there's a slight lag in updating the stats
tables, and a VACUUM might start or complete immediately after you
issue the query but before you read the results).  This method is
therefore unreliable.

> The idea is to detectect when table is not accessible due maintainance.

In modern versions of PostgreSQL a plain VACUUM (without FULL)
should have little impact on a table's accessibility unless you're
doing something that needs a strong lock (DDL, etc.).  But VACUUM
FULL and a few other commands do prevent other transactions from
accessing a table, so if you want to check for accessibility then
you need to check for more than just VACUUM.  You might be able to
use statement_timeout to make statements fail if they take longer
than expected, and infer from the failure that the table is
unavailable.  But again, that information could be stale by the
time you see it -- the table might become available immediately
after you decide that it isn't.

What problem are you trying to solve?  If we knew what you're really
trying to do then we might be able to make suggestions.

-- 
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux