-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Issue in GENERATED ALWAYS
PostPosted: Mon Jun 01, 2009 9:08 am 
Newbie

Joined: Mon Jun 01, 2009 8:59 am
Posts: 12
Hi,

I have a table and it has a column with GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1, CACHE 20,
NO MINVALUE, NO MAXVALUE, NO CYCLE, NO ORDER) .The table data in that column (Generated always) are not in sequencly ordered,For example values are 20,25,26,28,31 etc instead of 20,21,22,23,24 etc .

I appreciate your help on this.


Top
 Profile  
 
 Post subject: Re: Issue in GENERATED ALWAYS
PostPosted: Mon Jun 01, 2009 10:39 am 
Expert
Expert

Joined: Fri Jul 13, 2007 8:18 am
Posts: 370
Location: london
Each sequence number can only be allocated once so if you rollback a transaction after allocating a sequence there will be gaps.


Top
 Profile  
 
 Post subject: Re: Issue in GENERATED ALWAYS
PostPosted: Mon Jun 01, 2009 10:45 am 
Newbie

Joined: Mon Jun 01, 2009 8:59 am
Posts: 12
Yes,Thanks for your response.But no transaction has been rollbacked. Please let me know is there anything we need to do for the same.whenever the data got inserted the value on the column(Generated always) getting random number ,not in sequence order


Top
 Profile  
 
 Post subject: Re: Issue in GENERATED ALWAYS
PostPosted: Mon Jun 01, 2009 10:53 am 
Expert
Expert

Joined: Fri Jul 13, 2007 8:18 am
Posts: 370
Location: london
This discussion might be useful to you:
http://bytes.com/groups/ibm-db2/185464-generated-always-identity-clause


Top
 Profile  
 
 Post subject: Re: Issue in GENERATED ALWAYS
PostPosted: Mon Jun 01, 2009 11:06 am 
Newbie

Joined: Mon Jun 01, 2009 8:59 am
Posts: 12
Thanks once again...Let me check that.


Top
 Profile  
 
 Post subject: Re: Issue in GENERATED ALWAYS
PostPosted: Tue Jun 02, 2009 4:31 am 
Newbie

Joined: Mon Jun 01, 2009 8:59 am
Posts: 12
Hi,

By default DB2 caches 20 values for the identity for performance reasons. but When the database is deactivated this cache is lost, and thus the break in sequence????

if we use NO CACHE option also we may face same problem if you insert the data and then roll back performed .And If we use NO CACHE option the performance can degraded. is it???

Are you saying this issue only happens when the DB is deactivated? If so, then it’s something that I’d hope we don’t encounter in production (Unless it’s done outside of normal business operational hours), but what is the best way to prove this is what’s happening (Deactivate and Reactivate during a normal testing day?)..

An answer would be nice..thanks in advance


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.