I'm about to try to implement a simple pg_autovacuum script that can be used in conjunction with or integrated entirely with the contrib start-scripts for postgres. I just want to check that what I'm doing has the appropriate sanity checks.

The behavior I'm considering is:

if pg_ctl status returns a good value then
  if pg_autovacuum is not running then
    start pg_autovacuum
  else
    error
else
  error

Based on what I (think I) know, this covers the cases where:

1. There is not a valid instance of postgres running.
2. There is already a valid instance of pg_autovacuum running (which can still run as a daemon even in the event that postgres is stopped, IIRC).
3. It is safe to start pg_autovacuum because neither of the above cases holds.


Is this logic sufficiently sane?

In a subsequent iteration, I could even warn, I suppose, if the script discovered any vacuums (whether initiated by pg_autovacuum or no) already running.

-tfo


---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings

Reply via email to