Reputation: 73
start with 1
last value 1
increment by 1
cache 20
How does cache
preallocate the value and how does it get affected by previous value?
It's showing different results after few entries.
Upvotes: 1
Views: 115
Reputation: 231661
A sequence with a CACHE 20
setting caches 20 values on each instance (so each instance in a RAC cluster is working from a different cache).
I'm not sure exactly what you mean when you talk about "different results after few entries". My guess is that you are saying that there are gaps in the values generated-- that is expected, Oracle sequences will always have gaps. When your sequences have a CACHE
setting, one source of gaps is that if the sequence ages out of the shared pool (or if the instance is shut down), the cached values are discarded. That's not the only source of gaps so setting the sequence to NOCACHE
will not eliminate gaps. It will eliminate this particular source of gaps at a cost to performance.
Upvotes: 4