Re: Postgresql "FIFO" Tables, How-To ?

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Kirill Ponazdyr <softlist(at)codeangels(dot)com>
Cc: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>, pg_general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgresql "FIFO" Tables, How-To ?
Date: 2003-07-16 16:50:51
Message-ID: 20030716165051.GD1263@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jul 16, 2003 at 18:18:09 +0200,
Kirill Ponazdyr <softlist(at)codeangels(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Luis Magaña 2003-07-16 17:04:25 Re: ODBC query problem
Previous Message Shridhar Daithankar 2003-07-16 16:50:10 Re: Postgresql "FIFO" Tables, How-To ?