need help with a table shrinker - Mailing list pgsql-general

From Medi Montaseri
Subject need help with a table shrinker
Date
Msg-id 3DB7484C.2020009@intransa.com
Whole thread Raw
Responses Re: need help with a table shrinker
List pgsql-general
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



pgsql-general by date:

Previous
From: Medi Montaseri
Date:
Subject: vacuumdb -z --quiet
Next
From: Mike Beachy
Date:
Subject: Re: referential integrity violation