Thread: Postgresql Automatic vacuum

Postgresql Automatic vacuum

From
"Shridhar Daithankar"
Date:
Hello All,

I have written a small daemon that can automatically vacuum PostgreSQL
database, depending upon activity per table.

It sits on top of postgres statistics collector. The postgres installation
should have per row statistics collection enabled.

Features are,

* Vacuuming based on activity on the table
* Per table vacuum. So only heavily updated tables are vacuumed.
* multiple databases supported
* Performs 'vacuum analyze' only, so it will not block the database


The project location is
http://gborg.postgresql.org/project/pgavd/projdisplay.php

Let me know for bugs/improvements and comments..

I am sure real world postgres installations has some sort of scripts doing
similar thing. This is an attempt to provide a generic interface to periodic
vacuum.


Bye
 Shridhar

--
The Abrams' Principle:    The shortest distance between two points is off the
wall.


Re: Postgresql Automatic vacuum

From
Christoph Dalitz
Date:
>
> I have written a small daemon that can automatically vacuum PostgreSQL
> database, depending upon activity per table.
>
Sorry if this is an FAQ, but I have not found it in the docs:

Why can't PostgreSQL collect the statistic information itself automatically?
Are there any plans to implement this?

PG is the only database I know that places the burdon to keep PG's internal
statistics in the catalog up to date upon the database user.

Thanks,

Christoph Dalitz

Re: Postgresql Automatic vacuum

From
Martijn van Oosterhout
Date:
On Mon, Sep 23, 2002 at 08:14:58PM +0200, Christoph Dalitz wrote:
> >
> > I have written a small daemon that can automatically vacuum PostgreSQL
> > database, depending upon activity per table.
> >
> Sorry if this is an FAQ, but I have not found it in the docs:
>
> Why can't PostgreSQL collect the statistic information itself automatically?
> Are there any plans to implement this?
>
> PG is the only database I know that places the burdon to keep PG's internal
> statistics in the catalog up to date upon the database user.

I think it's history. For a long time the only way to update the statistics
was duraing a vacuum which locked the table. So it was unreasonable to do
that in the background. It is only recently the ANALYZE was seperated out.

Similarly, postgresql has no cron job system, that's what cron is for. The
statistics collector now running continuously is new so it is heading in the
right direction. If you can come up with some ideas as to when to trigger
automatically, feel free to contribute a patch. It may be accepted.

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.