Oracle9i在本地表空管理(LMT)的基础上,对段空间管理也引入了位图管理(Segment Space ManagementAuto)来取代原来的freelist管理方式(Segment Space Management Manual)。
pctused参数就是指:The PCTUSED
parameter sets theminimum percentage of a block that can be used for row data plusoverhead before new rows are added to the block. (下有)
In this case, a data block used for this table's datasegment is considered unavailable for the insertion of any new rowsuntil the amount of used space in the block falls to 39% or less(assuming that the block's used space has previously reachedPCTFREE
).
当数据块的使用空间小于PCTUSER的时候,就可以将block重新放回freelist上的。
官方地址:http://docs.oracle.com/cd/B19306_01/server.102/b14220/logical.htm#sthref344
The PCTFREE Parameter
The PCTFREE
parameter sets the minimumpercentage of a data block to be reserved as freespace for possible updates to rows that already exist in thatblock. For example, assume that you specify the following parameterwithin a CREATE
TABLE
statement:
PCTFREE 20
This states that 20% of each data block in this table's datasegment be kept free and available for possible updates to theexisting rows already within each block. New rows can be added tothe row data area, and corresponding information can be added tothe variable portions of the overhead area, until the row data andoverhead total 80% of the total block size. Figure 2-3illustrates PCTFREE
.
The PCTUSED Parameter
The PCTUSED
parameter sets theminimum percentage of a block that can be used for row data plusoverhead before new rows are added to the block. After adata block is filled to the limit determined byPCTFREE
, Oracle considers the block unavailable forthe insertion of new rows until the percentage of that block fallsbeneath the parameter PCTUSED
. Until this value isachieved, Oracle uses the free space of the data block only forupdates to rows already contained in the data block. For example,assume that you specify the following parameter in aCREATE
TABLE
statement:
PCTUSED 40
In this case, a data block used for this table's datasegment is considered unavailable for the insertion of any new rowsuntil the amount of used space in the block falls to 39% or less(assuming that the block's used space has previously reachedPCTFREE
).
How PCTFREE and PCTUSED Work Together
PCTFREE
and PCTUSED
worktogether to optimize the use of space in the data blocks of theextents within a data segment. Figure 2-5 illustrates the interaction of these twoparameters.
Figure 2-5 Maintaining the Free Space of DataBlocks with PCTFREE and PCTUSED
Description of "Figure 2-5Maintaining the Free Space of Data Blocks with PCTFREE andPCTUSED"
In a newly allocated datablock, the space available for inserts is the block size minus thesum 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 toless than PCTFREE
, the space reserved for updates butnot accessible to inserts.
For each data and index segment,Oracle maintains one or more freelists—lists of data blocks that have beenallocated for that segment's extents and have free space greaterthan PCTFREE
. These blocks are available for inserts.When you issue an INSERT
statement, Oracle checks afree list of the table for the first available data block and usesit if possible. If the free space in that block is not large enoughto accommodate the INSERT
statement, and the block isat least PCTUSED
, then Oracle takes the block off thefree list. Multiple free lists for each segment can reducecontention 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 thespace being used in the block is now less thanPCTUSED
. If it is, then the block goes to thebeginning of the transaction free list, and it is the first of theavailable blocks to be used in that transaction. When thetransaction commits, free space in the block becomes available forother transactions.