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

Thomas Kellerer <spam_eater@gmx.net>

From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@postgresql.org
Date: 2003-07-17T13:22:48Z
Lists: pgsql-general
Tom Lane schrieb:
> Thomas Kellerer <spam_eater@gmx.net> writes:
> 
>>But isn't that exactly the problem? Once the sequence wraps around how do I 
>>know that id=1 is actually later then id=2 without a date column?
> 
> 
> If you use an int8 sequence column, I doubt you need to worry about
> wraparound.  A date column probably hasn't got enough resolution,
> so the other workable approach is to use a timestamp column.  Ends up
> costing 8 bytes either way.
> 

I'm aware of that, I was referring to Sean's comment:

 > The nifty thing about using a wrapping sequence is that the id's are
 > sequential across transactions, which correctly maps to the
 > progression of time, which obviates the need for relying on any kind
 > of a date column for doing syslog message ordering.

If you only use the id, you can't really tell the message ordering by 
the ID as id=1 could well be inserted *after* id=2 due to the wrapping 
of the sequence

Cheers
Thomas