Re: Postgresql "FIFO" Tables, How-To ? - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: Postgresql "FIFO" Tables, How-To ?
Date
Msg-id 20030716165051.GD1263@wolff.to
Whole thread Raw
In response to Re: Postgresql "FIFO" Tables, How-To ?  ("Kirill Ponazdyr" <softlist@codeangels.com>)
List 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.

pgsql-general by date:

Previous
From: Luis Magaña
Date:
Subject: ODBC query problem
Next
From: Andrew Sullivan
Date:
Subject: Re: ODBC query problem