Extent Management And Segment Space Management

Storage in a Oracle datafile:

A table or an index is called a segment on the storage side of the Oracle database. Such een segment consists of extents. And these extents consists of blocks (the smallest unit of storage in a Oracle database). Most databases I see have a db_block_size of 8K (8192 bytes). If you only need one byte of information from a table, the least amount of bytes read is 8K bytes. All these blocks resides in files: datafiles. A few datafiles together form a tablespace. The following is a very brief explanation of how the storage within a tablespace can be managed.

In earlier versions (Oracle 9(?) and before) Oracle managed the extents in a tablespace in the Data Dictionary. If an extent was needed, the database looked for free space within the tablespace in a dictionary table, and if an extent was freed, again the data dictionary needed to be updated, to reflect the free space in the tablespace. You can imagine that is can become some of a performance problem when a lot of DML (insert/update/delete) takes place.

So Oracle thought of a smart way to overcome this: Locally managed tablespaces. Within each tablespace there is a bitmap area which effectively administrates the space within that tablespace. No need for updating tables in the datadictionary. A very fast update to the local bitmap can do the job, when reserving or freeing of extents in the tablespace. Within the Locally Managed Tablespace whe have two options for the allocation:Autoallocate Extent Management and Uniform Extent Management. Autoallocate determines itself the size of new extents for the segment. With Uniform you choose the (uniform) size of all extents within that tablespace.

If the tablespace is dictionary managed we can not do much anymore. However if a tablespace is locally managed, we have som more control over the allocation of space within the segment. We have a choice for Manual Segment Space Managment (MSSM) and Automatic Segment Space Management (ASSM). MSSM is somewhat legacy, it’s not used that often anymore. It uses Freelists to determine where free space resides within the segment, and requires a lot of tuning (FREE_LIST/PCT_USED/PCT_FREE) to have a reliable performance.

On the other hand ASSM uses (again) bitmaps to indicate the status of blocks within the segment. Again this is faster, and give less chance for contention. Only PCT_FREE can be tuned. PCT_FREE determines how much space in the block is reserved for later updates.

Leave a Reply

Your email address will not be published. Required fields are marked *