Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Re[3]: How do you generate primary keys?
Haven't tried this but how does this sound:
Use a sequence
cache it - to allow scalability
pin it so it doesn't age out of the cache
have a shutdown trigger make the sequence nocache so don't lose values on a clean shutdown
That leaves instance crashes and shutdown aborts to worry about
So, create a startup trigger that resets the current value of all sequences to the next correct value
For speed, the shutdown trigger could leave a flag somewhere so that the startup trigger only tried to process if it needed to
There's probably flaws in this so certainly test, test and test.
HTH,
Bruce Reardon
NOTICE: This e-mail and any attachments are private and confidential and may contain legally privileged information. If you are not an authorised recipient, the copying or distribution of this e-mail and any attachments is prohibited and you must not read, print or act in reliance on this e-mail or attachments. This notice should not be removed.
-----Original Message-----
Sent: Friday, 7 November 2003 1:15 AM
To: Multiple recipients of list ORACLE-L
Wednesday, November 5, 2003, 1:14:26 PM, Jamadagni, Rajendra (Rajendra.Jamadagni_at_espn.com) wrote: JR> hypothetically, When you have a requirement that no gaps allowed in a sequence no matter what, JR> would you still use sequences?
Ah! This is a good question. If no gaps are acceptable, period, end of story, then what is a viable solution? I do not think sequences are it.
Best regards,
Jonathan Gennick --- Brighten the corner where you are http://Gennick.com * 906.387.1698 * mailto:jonathan@gennick.com
Join the Oracle-article list and receive one article on Oracle technologies per month by email. To join, visit http://four.pairlist.net/mailman/listinfo/oracle-article, or send email to Oracle-article-request_at_gennick.com and include the word "subscribe" in either the subject or body.
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Jonathan Gennick
INET: jonathan_at_gennick.com
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Thu Nov 06 2003 - 15:34:27 CST
![]() |
![]() |