Overview of the Sequence Generator【每日一译】--20121207
2012-12-11 14:50
453 查看
The sequence generator provides a sequential series of numbers. The sequence
generator is especially useful in multiuser environments for generating unique
sequential numbers without the overhead of disk I/O or transaction locking. For
example, assume two users are simultaneously inserting new employee rows into the
employees table. By using a sequence to generate unique employee numbers for the
employee_id column, neither user has to wait for the other to enter the next
available employee number. The sequence automatically generates the correct values
for each user.
序列创建器提供了一个按顺序的数字的串行。序列创建器特别有用的在多用户环境下创建
唯一顺序数字没有额外的磁盘IO消耗或者事务锁。比如假定两个用户同时插入新的员工行到
EMPLOYEES表。通过使用一个序列去创建唯一的员工编号对于EMPLOYEE_ID列,两用户
都不用去等待输入下一个可用的员工号码。序列自动为每个用户创建正确的值。
Therefore, the sequence generator reduces serialization where the statements of two
transactions must generate sequential numbers at the same time. By avoiding the
serialization that results when multiple users wait for each other to generate and use a
sequence number, the sequence generator improves transaction throughput, and a
user’s wait is considerably shorter.
所以,序列创建器减少了串行化,两个语句事务必须创建顺序数字在同一时间。为了避免
串行的结果当多个用户等待其它每个去创建并且使用序列的数字,序列的创建器提高了事务
的吞吐量,并且用户的等待是相当短暂的。
Sequence numbers are Oracle integers of up to 38 digits defined in the database. A
sequence definition indicates general information, such as the following:
■ The name of the sequence
■ Whether the sequence ascends or descends
■ The interval between numbers
■ Whether Oracle should cache sets of generated sequence numbers in memory
序列的数字是ORACLE整数最大到38位的定义在数据库中。一个序列定义包含一般信息,如下:
#序列的名字
#序列是升序还是降序
#数字间的周期大小差
#ORACLE是否缓存创建序列的数字集在内存中
Oracle stores the definitions of all sequences for a particular database as rows in a
single data dictionary table in the SYSTEM tablespace. Therefore, all sequence
definitions are always available, because the SYSTEM tablespace is always online.
Sequence numbers are used by SQL statements that reference the sequence. You can
issue a statement to generate a new sequence number or use the current sequence
number. After a statement in a user’s session generates a sequence number, the
particular sequence number is available only to that session. Each user that references
a sequence has access to the current sequence number.
ORACLE存储所有序列的定义对于一个特定的数据库里,像行一样在一个单独的数据字典,它
位于SYSTEM表空间。所以,所有的序列定义一直是可用的,因为SYSTEM表空间是一直在线的。
序列的数字用于与序列相关的SQL语句中。你可以输入一个语句去创建一个新的序列数字或者使用
当前的序列号。在一个用户会话中在一个语句后创建了一个序列号,那个特定的序列号仅对当前这个
用户可用。每个关于序列的用户拥有访问当前序列号的权限。
Sequence numbers are generated independently of tables. Therefore, the same
sequence generator can be used for more than one table. Sequence number generation
is useful to generate unique primary keys for your data automatically and to
coordinate keys across multiple rows or tables. Individual sequence numbers can be
skipped if they were generated and used in a transaction that was ultimately rolled
back. Applications can make provisions to catch and reuse these sequence numbers, if
desired.
序列号独立创建于表。所以,同一个序列创建器可以被用于多个表。序列号的创建是非常有用的
去自动创建唯一的主键并且在多个行或者多个表中协调主键。个别的序列号可以被跳过如果它们被
创建并且在事务中的使用最终回退。应用可以设定规定去获取并且重用这些序列号,如果期望。
Caution: If your application can never lose sequence numbers,
then you cannot use Oracle sequences, and you may choose to store
sequence numbers in database tables. Be careful when
implementing sequence generators using database tables. Even in a
single instance configuration, for a high rate of sequence values
generation, a performance overhead is associated with the cost of
locking the row that stores the sequence value.
警告:如果你的应用不能丢失序列号,那么你不能使用ORACLE序列,你可以选择去存储序列号在数据库
表中。当使用数据库表去实现序列的创建时要小心。甚至在单实例的配置中,对于一个序列值创建高频率情况
一个性能的消耗有关于存储序列值的行的锁的成本。
generator is especially useful in multiuser environments for generating unique
sequential numbers without the overhead of disk I/O or transaction locking. For
example, assume two users are simultaneously inserting new employee rows into the
employees table. By using a sequence to generate unique employee numbers for the
employee_id column, neither user has to wait for the other to enter the next
available employee number. The sequence automatically generates the correct values
for each user.
序列创建器提供了一个按顺序的数字的串行。序列创建器特别有用的在多用户环境下创建
唯一顺序数字没有额外的磁盘IO消耗或者事务锁。比如假定两个用户同时插入新的员工行到
EMPLOYEES表。通过使用一个序列去创建唯一的员工编号对于EMPLOYEE_ID列,两用户
都不用去等待输入下一个可用的员工号码。序列自动为每个用户创建正确的值。
Therefore, the sequence generator reduces serialization where the statements of two
transactions must generate sequential numbers at the same time. By avoiding the
serialization that results when multiple users wait for each other to generate and use a
sequence number, the sequence generator improves transaction throughput, and a
user’s wait is considerably shorter.
所以,序列创建器减少了串行化,两个语句事务必须创建顺序数字在同一时间。为了避免
串行的结果当多个用户等待其它每个去创建并且使用序列的数字,序列的创建器提高了事务
的吞吐量,并且用户的等待是相当短暂的。
Sequence numbers are Oracle integers of up to 38 digits defined in the database. A
sequence definition indicates general information, such as the following:
■ The name of the sequence
■ Whether the sequence ascends or descends
■ The interval between numbers
■ Whether Oracle should cache sets of generated sequence numbers in memory
序列的数字是ORACLE整数最大到38位的定义在数据库中。一个序列定义包含一般信息,如下:
#序列的名字
#序列是升序还是降序
#数字间的周期大小差
#ORACLE是否缓存创建序列的数字集在内存中
Oracle stores the definitions of all sequences for a particular database as rows in a
single data dictionary table in the SYSTEM tablespace. Therefore, all sequence
definitions are always available, because the SYSTEM tablespace is always online.
Sequence numbers are used by SQL statements that reference the sequence. You can
issue a statement to generate a new sequence number or use the current sequence
number. After a statement in a user’s session generates a sequence number, the
particular sequence number is available only to that session. Each user that references
a sequence has access to the current sequence number.
ORACLE存储所有序列的定义对于一个特定的数据库里,像行一样在一个单独的数据字典,它
位于SYSTEM表空间。所以,所有的序列定义一直是可用的,因为SYSTEM表空间是一直在线的。
序列的数字用于与序列相关的SQL语句中。你可以输入一个语句去创建一个新的序列数字或者使用
当前的序列号。在一个用户会话中在一个语句后创建了一个序列号,那个特定的序列号仅对当前这个
用户可用。每个关于序列的用户拥有访问当前序列号的权限。
Sequence numbers are generated independently of tables. Therefore, the same
sequence generator can be used for more than one table. Sequence number generation
is useful to generate unique primary keys for your data automatically and to
coordinate keys across multiple rows or tables. Individual sequence numbers can be
skipped if they were generated and used in a transaction that was ultimately rolled
back. Applications can make provisions to catch and reuse these sequence numbers, if
desired.
序列号独立创建于表。所以,同一个序列创建器可以被用于多个表。序列号的创建是非常有用的
去自动创建唯一的主键并且在多个行或者多个表中协调主键。个别的序列号可以被跳过如果它们被
创建并且在事务中的使用最终回退。应用可以设定规定去获取并且重用这些序列号,如果期望。
Caution: If your application can never lose sequence numbers,
then you cannot use Oracle sequences, and you may choose to store
sequence numbers in database tables. Be careful when
implementing sequence generators using database tables. Even in a
single instance configuration, for a high rate of sequence values
generation, a performance overhead is associated with the cost of
locking the row that stores the sequence value.
警告:如果你的应用不能丢失序列号,那么你不能使用ORACLE序列,你可以选择去存储序列号在数据库
表中。当使用数据库表去实现序列的创建时要小心。甚至在单实例的配置中,对于一个序列值创建高频率情况
一个性能的消耗有关于存储序列值的行的锁的成本。
相关文章推荐
- An Overview of the AI in Football Games from Cheating to Machine Learning..
- 深入学习heritrix---体系结构(Overview of the crawler)
- 1 An Overview of the Tesseract OCR Engine
- Overview of the High Efficiency Video Coding Standard——Inter-picture prediction(一)
- Evaluate the Costs and Benefits of Using DBMS_REPAIR【每日一译】--2012-10-26
- Data migration to generate the maximum value of the sequence between beta scheme and appbeta scheme
- 每日英语:The Benefits of a Better Men's T-Shirt
- chapter 25 An Overview of the C API
- 每日英语:The Exercise Equivalent of a Cheeseburger?
- Business Component Factory : A Comprehensive Overview of Component-Based Development for the Enterpr
- Overview of the V4L2 driver framework(一)
- Overview of the High Efficiency Video Coding Standard——Inter-picture prediction(二)
- Overview of the Architecture of ADO.NET.
- Overview of the High Efficiency Video Coding(HEVC) Standard之三
- [RxJS] How To get the results of two HTTP requests made in sequence
- 每日英语:The Rise Of The Female Investor
- A brief overview of the Windows debuggers
- 每日英语:The Future of Typing
- Overview of Synonyms【每日一译】--20121208
- The study of generator in Python(20170912)