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