Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Risk in using sequence number?

Re: Risk in using sequence number?

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Thu, 21 Feb 2002 22:49:57 +0100
Message-ID: <pnqa7uc1th9gp1ipq4c445br6n0rp29hr3@4ax.com>


On Thu, 21 Feb 2002 21:20:30 -0000, "Keith Boulton" <kboulton_at_ntlworld.com> wrote:

>
>Sybrand Bakker <postbus_at_sybrandb.demon.nl> wrote in message
>news:3koa7u0fh6uhhs69c1n14glq9cqg1716r7_at_4ax.com...
>> On Thu, 21 Feb 2002 13:18:25 -0700, "Leigh Gold" <intan_5ee_at_yahoo.com>
>> wrote:
>>
>> >What is the risk involved in using sequence number to keep track of the
>last
>> >record in a table?
>> >
>> >We use a table to keep history of an event, everytime an event changes,
>we
>> >insert a row in this history table with a sequence number as its primary
>key
>> >and information about this event. We are basing our query on
>max(sequence)
>> >to track the last time this event occurred. For some reason, the
>developer
>> >refuses to use sysdate for this purpose.
>> >
>> >Is there any risk involved in using the method?
>> >
>> >Thanks,
>> >
>> >Leigh
>> >
>> >
>> >
>> Loosing sequence numbers is inevitable using the cache option (which
>> is the default) I'm not sure this won't happen with the nocache
>> option. However, I never use that as the sequence number is supposed
>> to be meaningless, and your sequence number should be meaningful.
>> Probably hiring a different developer will be cheaper in the long run.
>>
>Except that the current developer is right - dates are precise only to the
>second and it is very easy to generate more than 1 event per second.
>
>The use of sequences for this purpose is reasonable, I believe, given only
>that OPS is not used since multiple instances of the sequence exist so the
>allocation of sequence numbers does not occur sequentially (eh?). You also
>have to ensure that the sequence will never wrap.
>
>
>

Operators, not being trained monkeys, usually don't insert more than one record per second. And if you really need the time you can always use dbms_utility.get_time, which is in hundreths of a second. Other than that, if this are non-human inserts, you should ask what you need the sequence for. Looks like an issue of lousy coding, and definitely non-relational.

Regards

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Thu Feb 21 2002 - 15:49:57 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US