Re: Retrieving records in order they were placed.

From: Graham Miller <lgmiller_at_elmrd.u-net.com>
Date: Fri, 09 Jul 1999 17:18:09 GMT
Message-ID: <37862474.2213552_at_news.u-net.com>


Hello,

Not sure why your sequences would need to rollover in your lifetime.

For instance, imagine you want to insert one million items per second into a database. This gives about 3.1 E13 events per year. A 20 digit sequence number will use 11 bytes of space and rollover in about two million years.
Ok, thats silly, how about a thousand events a second and a sequence number which occupies the same space as a date? Rollover in 292 years.

Note: Oracle will work with integers with more than 40 digits of precision. It is silly accuracy.

I have tried a 20 digit sequence - works fine.

graham

On Fri, 09 Jul 1999 12:57:03 GMT, b_rich2_at_my-deja.com wrote:

>I have to put records into a table, and later retrieve them in the order
>in which they were placed. I have a very very large number of entries to
>be placed in a live system. The records are logs of important events in
>the system.
>
>My first thought was to use the unix time stamp to place as the field to
>order on, but there will probably be many entries entered in rapid
>succession. Thus many entries could be entered at the same time stamp
>interval.
>
>I then though of having a sequence number associated with each record,
>increasing one by one with each record stored. This will work well until
>the sequence numbers begin to wrap. If they are retrieved in order of
>sequence number, and then they wrap, the records entered after the wrap
>(sequences 1,2,3,4 etc) will all of a sudden be pulled out before the
>earlier records with high sequence numbers.
>
>Another idea is to just use the sequence numbers, and re-boot the box
>every few weeks when the sequence numbers get high, but this is really
>unacceptable in the environment where this will be run.
>
>Does anyone know how to get around this problem? Any help would be
>GREATLY appreciated.
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
Received on Fri Jul 09 1999 - 19:18:09 CEST

Original text of this message