I am not sure if i am posting this question in the right place,but any help is appreciated. What is the best way to generate a primary key for a system that has high concurrent database hits.If i use locking mechanism then it leads to a deadlock.Is there any work around for this.
I believe that the key generation for Oracle provides a batch of keys to each Connection, so you shouldn't need to worry. Not sure I like the milliseconds solution, providing your own implemenation of a GUID provider (Globally unique id - search the web!) would be a simple solution on the application end.
Joined: Aug 15, 2004
are you people talking about sequences as batch of keys??
if it is sequences then i read in oracle dba certification guide for 9i that it is not recommended to use sequences. you can use sequences if you just want something unique for your key and not going to manipulate the records based on that. because of some key points,
- max limit - min limit - cycle | nocycle - it is a seperate object inside DB - we can use same sequence for multiple tables
and we need to tune it after sometime in a regular fashion or better say time to time. [ October 07, 2004: Message edited by: adeel ansari ]