Skip site navigation (1) Skip section navigation (2)

Re: unpacking composite values

From: Keith Worthington <KeithW(at)NarrowPathInc(dot)com>
To: alex <alex(dot)ricci(at)arkantechnologies(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: unpacking composite values
Date: 2005-06-26 11:26:44
Message-ID: 42BE90F4.3000102@NarrowPathInc.com (view raw or flat)
Thread:
Lists: pgsql-novice
alex wrote:
> Hi,
> 
> Is it possible to limit the size or the number of rows of table, in a 
> FIFO mode for example ??
> 
> Regards
> 
> Al

Hmmm, do you mean that every time a row is INSERTed that you want to 
delete the oldest row?

How about a serial column and an AFTER INSERT trigger?  The trigger 
could search for and delete the row with the smallest serial value. 
This could get real slow if your table is huge.  If the volume is high 
enough then you will have to handle wrap around.  You could simply write 
a script that would subtract the minimum value from all the rows when 
the serial reached the maximum.

-- 
Kind Regards,
Keith

In response to

Responses

pgsql-novice by date

Next:From: alexDate: 2005-06-26 11:42:09
Subject: Re: limit tables size
Previous:From: alexDate: 2005-06-26 06:02:04
Subject: Re: unpacking composite values

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group