The structure of ROWID and data rows in Oracle

Source: Internet
Author: User

In an Oracle database system, each row has a Rowid,oracle database system that uses ROWID to locate data rows. rowID is also a scalar data type built into Oracle

rowID has a feature;

is a unique identifier for each row in the database

Does not display a value that stores a column

Can be used to locate a row, although there is no physical address for the trip directly

Provides the fastest mechanism for accessing data rows in a table

1) There are two types of rowid: Limit rowID and extend ROWID

I. Expansion of ROWID

The extension rowID was introduced in the Oracle8i version, with the following structure:

Data Object number + relative file number + block number + line number

Storage (32bit) (10bit) (22bit) (16bit) =10b

Display 6 3 6 3

An extended ROWID requires 10B of space storage with 18 characters to display its composition as follows

1. Data Object number: The data object number that uniquely identifies the database object and is assigned to each object

2. Relative file Number: Each file in the same tablespace is unique and identifies a different data file in the same table space

3. Block number: The location of the data block that contains the data rows in the file

4, line number: Identifies the location of the header row directory

The display of the extended ROWID is a 64-bit encoding with a display character of A~z A~z 0~9 and +,/a total of 64 characters

Oracle uses ROWID to locate data rows:

1. Use data object number to find table space

2, use relative file number to find the stored data file

3. Use block numbers to locate data blocks that store data rows

4. Use the line number to locate the row directory entry, and then use the row directory entry to locate the starting address of the data row

Ii. Limitation of ROWID

The biggest difference between a oracle7 or a previous version of the extension ROWID is that no data object number is stored internally with only 6 bytes. Locate data rows in Oracle by traversing the table space and looking down until the line number. Therefore, before the oracle7i version requires a maximum number of data files of 1022. After 8i due to the addition of the data object number, it is required to tablespace up to 1022.

2) Structure of Oracle data rows

To conserve storage space Oracle uses a special data row storage structure. Each row of data is stored in a data block in the form of a variable-length record. Usually the columns in a row are stored in the order in which they are defined, and the empty columns at the end are not stored, but an empty column with a non-end requires a byte of storage length.

The composition of the data rows:

Wardrobe: The status of the migration information and row locks used to store the number of columns in the row

Row data: Each column in the corresponding data row consists of a series of column lengths and column values the Oracle server stores the column length of the column and the actual value of the column

Column length: One byte is generally required

Column value: The actual value of the column is followed by the column long byte after the storage

Oracle's storage is very compact and does not require any space between adjacent rows of data in an Oracle system. Each row in the data block has a slot in the row directory that points to the starting address of the data row.

  

  

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.