Thread: Re: Sequence Question DOH!

Re: Sequence Question DOH!

From
Oscar Tuscon
Date:
Not sure how I managed to interchange Greg's reply and my response, but here's mine again:


Thanks, I figured that, but was hoping otherwise. I realize that the timing would make it unlikely, but unfortunately I
need100% guaranteed. I have an alternative in that I control the accessing clients (my app) and can apply a lock to
preventit from happening. 

I found the average select nextval() call was taking 2ms, which seems a bit slow to me. Throw in the fsync I suppose
andthat'd explain it. 
Interestingly, in the tests I ran the minimum select nextval() was 400us, and the max was 35ms, with an average of 2ms.
Thiswas on a DL380 dual 2.4G processors, 2.5G RAM, 5x10k SCSI drives, and no load - pretty much idle (well, a processes
checkingfor entries in a command table 10 times per second). 

Oscar


_____________________________________________________________
The BMW E30 community on the web---> http://www.bmwe30.net

Re: Sequence Question DOH!

From
Tom Lane
Date:
Oscar Tuscon <obtuse@bmwe30.net> writes:
> I found the average select nextval() call was taking 2ms, which seems
> a bit slow to me. Throw in the fsync I suppose and that'd explain it.

> Interestingly, in the tests I ran the minimum select nextval() was
> 400us, and the max was 35ms, with an average of 2ms.

I believe that nextval() only actually writes to disk once every 32
calls.  This probably explains the variability.

            regards, tom lane

Re: Sequence Question DOH!

From
Richard Huxton
Date:
Oscar Tuscon wrote:
> Not sure how I managed to interchange Greg's reply and my response,
> but here's mine again:

Oscar - if you're still interested in grabbing variable ranges of
sequence-id's then I had an idea. Just multiply nextval() by 1000 (or
whatever) and use however many you need. You'll want to set the maximum
for the sequence correspondingly lower.

--
   Richard Huxton
   Archonet Ltd