Oracle Sequence 未生成连续数

2021-12-24 00:00:00 sequence oracle11g oracle plsql

我在 oracle 中有一个将用作 SYSID 的序列.序列不是按顺序生成的,这意味着它在某些地方跳过数字,然后继续.

I have one sequence in oracle which will be used as SYSID. The sequence is not generating in orderly fashion, means some where it is skipping the numbers, then it is continuing.

下面是我的序列

CREATE SEQUENCE leaveform_seq 
MINVALUE 1 MAXVALUE 999999999999999999999999999 
INCREMENT BY 1 START WITH 1560
CACHE 20 ORDER NOCYCLE;

序列的任何替代方案?

推荐答案

Oracle 序列是保证系列唯一数字的生成器多用户环境.性能和可扩展性的权衡是,系列中偶尔会出现差距.

An Oracle sequence is generator for a guaranteed series of unique numbers which performs well and scales in a multi-user environment. The trade off for performance and scalability is that occasionally there are gaps in the series.

发现这种差距对组织真正重要的用例非常罕见.尽管不幸的是,人们对他们陷入不必要的狂热是很常见的.

It is incredibly rare to find a use case where such gaps really matter to the organisation. Although it is tragically all too common for people to get into a needless frenzy about them.

是否有序列的替代方案?当然,我们总是可以自由地编写自己的代码.根据您的业务需求,它可能非常简单,也可能相当复杂.

Are there alternatives to sequences? Sure, we're always free to write our own code. Depending on your business needs it might be quite simple or it might be rather complicated.

需要牢记的重要事项是性能和可扩展性.通过选择不使用序列,您不可避免地要牺牲一些两者.但是编写您自己的系列生成器提供了一个真正搞砸事情的机会.

The important things to bear in mind to bear in mind are performance and scalability. You are inevitably sacrificing a bit of both by choosing not to use a sequence. But writing your own series generator provides an opportunity to really muck things up.

因此,请了解其中的含义,并确保您的老板完全相信这个想法.

So, understand the implications and be sure your boss is fully sold on the idea.

相关文章