Thread: need help with a table shrinker

need help with a table shrinker

From
Medi Montaseri
Date:
I have a  table that is getting 500 inserts per minute.

Currently application is keeping track of the size of this table and
purging down to 80% of
some Max and vacuum-ing right after.

I'm looking for a solution to deligate this task to the PG engine
itself. Is this possible?

One solution (I suppose) would be to implement a cron emulator, how I
don't know but
its an interesting task.

Another would be to implement a trigger on INSERT, that gets the COUNT
of records
and proceeds to trim or not. But getting the COUNT using built-in
aggregate function might
be too expensive for every INSERT. Is there any system table that can be
querried for the
number of records in a given table ?

I'm sure this is a common problem and have been solved many many times
over.
Hence this email.

Thanks



Re: need help with a table shrinker

From
"Shridhar Daithankar"
Date:
On 23 Oct 2002 at 18:09, Medi Montaseri wrote:

> One solution (I suppose) would be to implement a cron emulator, how I
> don't know but
> its an interesting task.

Have a look at http://gborg.postgresql.org/project/pgavd/projdisplay.php.

I have written it. Please use CVS version as I haven't seen anybody actualy
using it so didn't bother packaging some latest changes. If you have any
problems, I would be more than happy to help..

Bye
 Shridhar

--
Shaw's Principle:    Build a system that even a fool can use, and only a fool will
want to use it.