A segment is a container for objects (such as tables, indexes....). A segment consists of extents. Segment typesThere are 11 types of segments in Oracle 10g: - table
- table partition
- index
- index partition
- cluster
- rollback
- deferred rollback
- temporary
- cache
- lobsegment
- lobindex
These types can be grouped into four segment classes: - data segments: table and cluster
- index
- rollback
- temporary data
In order to find out the size of the respective segments, use dba_segments (or user_segments, or all_segments). A segment can either be created so that it can have an unlimited or limited number of extents. Oracle keeps track of free blocks for each data segment. The segment header is stored in the first block of the first extent. It contains: - The extents table
- The free lists descriptors
- The high water mark
Temporary segmentsThe following SQL statements require a temporary segment if they cannot be completed in memory: - create index.
- select order by
- select distinct
- select group by
- select union
- select intersect
- select minus by
- analyze table
- unindexed joins
- certain correlated subqueries
Actually, most of these statements require a sort. Temporary segments can be stored in any tablespace. However, it makes more sense to store temporary segments in a temporary tablespace. SMON frees temporary segments. |
No comments:
Post a Comment