Re: Sequence Question DOH! - Mailing list pgsql-general

From Oscar Tuscon
Subject Re: Sequence Question DOH!
Date
Msg-id 20040806181041.9C43AAD5E@sitemail.everyone.net
Whole thread Raw
List pgsql-general
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

Thanks Richard,
I'd considered using an approach as you suggest, but I need long term high volume scalability and don't want to waste
sequencevalues. Not that 2**64 will happen anytime soon... 

What I did was to use my existing shm subsystem, which controls accesses with semaphores, and allocated a lock obj. I
justmodified my sequence accessor (which was already abstracted to keep db independence) to lock/unlock around sequence
nextval/setval.Since the majority of my sequence requirements are for batches I wound up with about a 30% net app
performanceimprovement (and about 500x in the sequence accessing!) 

Oscar


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

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: replication
Next
From: "Scott Marlowe"
Date:
Subject: Re: Slow after VACUUM, fast after DROP-CREATE INDEX