ITPub博客

首页 > 数据库 > Oracle > PCTFREE, PCTUSED and Row Chaining

PCTFREE, PCTUSED and Row Chaining

翻译 Oracle 作者:wanghanjun 时间:2016-01-06 09:13:29 0 删除 编辑
http://docs.oracle.com/cd/B19306_01/server.102/b14220/logical.htm

PCTFREE, PCTUSED, and Row Chaining

For manually managed tablespaces, two space management parameters, PCTFREE and PCTUSED, enable you to control the use of free space for inserts and updates to the rows in all the data blocks of a particular segment. Specify these parameters when you create or alter a table or cluster (which has its own data segment). You can also specify the storage parameter PCTFREE when creating or altering an index (which has its own index segment).
对于手动管理的表空间,有两个空间管理的参数 PCTFREE和PCTUSED,能够让你来控制INSERT和UPDATE之后的可用空间在一个段内的所有数据块.可以通过创建或者修改表或者聚集索引的时候来指定这些参数.PCTFREE也可以用于创建或者修改索引

Note:

This discussion does not apply to LOB datatypes (BLOB, CLOB, NCLOB, and BFILE). They do not use the PCTFREE storage parameter or free lists.

See "Overview of LOB Datatypes" for information.

The PCTFREE Parameter

The PCTFREE parameter sets the minimum percentage of a data block to be reserved as free space for possible updates to rows that already exist in that block. For example, assume that you specify the following parameter within a CREATE TABLE statement:
PCTFREE用于设置一个数据块用于UPDATE而保留空间的百分比, 

PCTFREE 20 

This states that 20% of each data block in this table's data segment be kept free and available for possible updates to the existing rows already within each block. New rows can be added to the row data area, and corresponding information can be added to the variable portions of the overhead area, until the row data and overhead total 80% of the total block size. Figure 2-3illustratesPCTFREE.
20%的意思是这个表的数据段的每一个数据块都有20%的可用空间来保存UPDATE当前存在的行.如果是新的行会被加入到新的块中.相关的信息会增加到overhead区域中直到行数据和overhead加起来超过整个数据块的80%                                                                                    

The PCTUSED Parameter

The PCTUSED parameter sets the minimum percentage of a block that can be used for row data plus overhead before new rows are added to the block. After a data block is filled to the limit determined by PCTFREE, Oracle considers the block unavailable for the insertion of new rows until the percentage of that block falls beneath the parameter PCTUSED. Until this value is achieved, Oracle uses the free space of the data block only for updates to rows already contained in the data block. For example, assume that you specify the following parameter in a CREATE TABLEstatement:

PCTUSED 40 

In this case, a data block used for this table's data segment is considered unavailable for the insertion of any new rows until the amount of used space in the block falls to 39% or less (assuming that the block's used space has previously reached PCTFREE). Figure 2-4 illustrates this.

How PCTFREE and PCTUSED Work Together

PCTFREE and PCTUSED work together to optimize the use of space in the data blocks of the extents within a data segment. Figure 2-5 illustrates the interaction of these two parameters.

Figure 2-5 Maintaining the Free Space of Data Blocks with PCTFREE and PCTUSED

De.ion of Figure 2-5 follows
Description of "Figure 2-5 Maintaining the Free Space of Data Blocks with PCTFREE and PCTUSED"

In a newly allocated data block, the space available for inserts is the block size minus the sum of the block overhead and free space (PCTFREE). Updates to existing data can use any available space in the block. Therefore, updates can reduce the available space of a block to less than PCTFREE, the space reserved for updates but not accessible to inserts.
在一个新创建的数据块中,INSERT的可用空间是整个块的空间剪掉overhead和PCTFREE的空间,UPDATE可以使用所有的可用空间.因此,UPDATE能够鉴定一个数据块的可用空间到 PCTFREE以下,并且这个区域会为UPDATE保留但是不会插入新的数据

For each data and index segment, Oracle maintains one or more free listslists of data blocks that have been allocated for that segment's extents and have free space greater than PCTFREE. These blocks are available for inserts. When you issue an INSERT statement, Oracle checks a free list of the table for the first available data block and uses it if possible. If the free space in that block is not large enough to accommodate the INSERT statement, and the block is at least PCTUSED, then Oracle takes the block off the free list. Multiple free lists for each segment can reduce contention for free lists when concurrent inserts take place.

After you issue a DELETE or UPDATE statement, Oracle processes the statement and checks to see if the space being used in the block is now less than PCTUSED. If it is, then the block goes to the beginning of the transaction free list, and it is the first of the available blocks to be used in that transaction. When the transaction commits, free space in the block becomes available for other transactions.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8747612/viewspace-1972290/,如需转载,请注明出处,否则将追究法律责任。

上一篇: PASSWORD_GRACE_TIME
请登录后发表评论 登录
全部评论

注册时间:2014-05-28

  • 博文量
    42
  • 访问量
    31531