Re: Postgresql "FIFO" Tables, How-To ?
Bruno Wolff III <bruno@wolff.to>
From: Bruno Wolff III <bruno@wolff.to>
To: Kirill Ponazdyr <softlist@codeangels.com>
Cc: "Nigel J. Andrews" <nandrews@investsystems.co.uk>, pg_general <pgsql-general@postgresql.org>
Date: 2003-07-16T16:50:51Z
Lists: pgsql-general
On Wed, Jul 16, 2003 at 18:18:09 +0200, Kirill Ponazdyr <softlist@codeangels.com> wrote: > > Ouch, this means that for every insert we would have to trigger a > procedure which will: > > COUNT > IF > Limit > DELETE OLDEST > > This would be pretty much damn ressource intensive on a table with million > of records, would not it ? If you preload the database with the required number of records, then you don't need to count. You can just delete the oldest record. You can use a sequence or timestamp to order the records for this purpose. If you don't to see the dummy records you can flag them somehow. But if you reach the limit in a short time you might not really care about that enough to add the extra overhead.