You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Karl Weber <ka...@googlemail.com> on 2012/02/26 09:45:46 UTC

Sequence loses numbers: bug or feature?

I have created a sequence using

CREATE SEQUENCE GPS.SDSID 
	AS INTEGER
	START WITH 1 
	INCREMENT BY 1 
	NO CYCLE;

and get values using

NEXT VALUE FOR GPS.SDSID

in separate SELECT statements with jdbc. The corresponding connection has 
autocommit = true.

As long as derby is running I get successive numbers, but when derby is shut 
down in between I get gaps. Those gaps are quite bad.

Is this a bug or a feature, i.e. is derby buffering about five sequence 
numbers in memory (for, e.g., performance reasons), which are lost if derby is 
shut down? Is there a way to prohibit losing numbers?

Re: Sequence loses numbers: bug or feature?

Posted by Jean-Yves Linet <jy...@gmail.com>.
I guess answers to your questions are here :
https://issues.apache.org/jira/browse/DERBY-5151


Le 26 février 2012 09:45, Karl Weber <ka...@googlemail.com> a écrit :

> I have created a sequence using
>
> CREATE SEQUENCE GPS.SDSID
>        AS INTEGER
>        START WITH 1
>        INCREMENT BY 1
>        NO CYCLE;
>
> and get values using
>
> NEXT VALUE FOR GPS.SDSID
>
> in separate SELECT statements with jdbc. The corresponding connection has
> autocommit = true.
>
> As long as derby is running I get successive numbers, but when derby is
> shut
> down in between I get gaps. Those gaps are quite bad.
>
> Is this a bug or a feature, i.e. is derby buffering about five sequence
> numbers in memory (for, e.g., performance reasons), which are lost if
> derby is
> shut down? Is there a way to prohibit losing numbers?
>