need help with a table shrinker

From: Medi Montaseri <medi(dot)montaseri(at)intransa(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: need help with a table shrinker
Date: 2002-10-24 01:09:32
Message-ID: 3DB7484C.2020009@intransa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paulo Henrique Baptista de Oliveira 2002-10-24 01:36:31 2 questions
Previous Message Martijn van Oosterhout 2002-10-24 00:29:55 Re: Recover data from crashed HD