Row Format and Size【每日一译】--20121123

来源:互联网 发布:node.js 知乎 编辑:程序博客网 时间:2024/05/22 17:41
Oracle stores each row of a database table containing data for less than 256 columns as
one or more row pieces. If an entire row can be inserted into a single data block, then
Oracle stores the row as one row piece. However, if all of a row’s data cannot be
inserted into a single data block or if an update to an existing row causes the row to
outgrow its data block, then Oracle stores the row using multiple row pieces. A data
block usually contains only one row piece for each row. When Oracle must store a row

in more than one row piece, it is chained across multiple blocks.

ORACLE存储数据库表的每一行,它包含的数据小于256列作为一行或多行片段。如果整行能插入到

一个单独的数据块,那么ORACLE存储那一行作为一个行片。但当一行数据不能插入到一个单独数据

块或者一个UPDATE更新一条存在行导致超出了它所在的数据块,那么ORACLE存储那一行使用多行片。

一个数据块通常包含一行片断对于每一行。当ORACLE必须存储一行在多于一行片断时,它是通过多个

块链接的。

When a table has more than 255 columns, rows that have data after the 255th column
are likely to be chained within the same block. This is called intra-block chaining. A
chained row’s pieces are chained together using the rowids of the pieces. With
intra-block chaining, users receive all the data in the same block. If the row fits in the
block, users do not see an effect in I/O performance, because no extra I/O operation is
required to retrieve the rest of the row.

当一个表拥有的例超过255列,行拥有的超过255列的数据将最有可能的在同一个块内链接。这个

叫作内部块链接。一个链接行片链接在一起通过片的ROWID。通过内部块的链接,用户获得所有的数据在

相同的块中。如果行适合在块中,用户看不到它对IO性能的影响,因为不需要外部的IO操作要求去返回行

剩余的数据。

Each row piece, chained or unchained, contains a row header and data for all or some
of the row’s columns. Individual columns can also span row pieces and, consequently,
data blocks. Figure 5–3 shows the format of a row piece:

每个行片,链接或者非链接,包含一个行的头部和所有或者部份行列的数据。独立列也可以

扩展行片,数据块。


The row header precedes the data and contains information about:
■ Row pieces
■ Chaining (for chained row pieces only)
■ Columns in the row piece
■ Cluster keys (for clustered data only)
A row fully contained in one block has at least 3 bytes of row header. After the row
header information, each row contains column length and data. The column length
requires 1 byte for columns that store 250 bytes or less, or 3 bytes for columns that
store more than 250 bytes, and precedes the column data. Space required for column
data depends on the datatype. If the datatype of a column is variable length, then the
space required to hold a value can grow and shrink with updates to the data.
To conserve space, a null in a column only stores the column length (zero). Oracle does
not store data for the null column. Also, for trailing null columns, Oracle does not even
store the column length.

行头部前的数据包含的信息关于:

#行片

#链接(仅针对链接行片)

#在行片中的列

#集群键(仅针对集群数据)

一行完全包含在一个块中至少含有3字节的空间在行头部中。在行头部信息后,每行包含列的长度

和数据。列的长度对于所有列要求1字节,它存储250的字节或者更少,或者是3字节对于所有列,它

存储超过250字节,并且在列数据的前面。对于列数据的空间需求取决于数据类型。如果一个列的数据

类型是可用的长度,那么对于保留一个值的空间要求可以增长或缩小通过更新数据。

为了节省空间,一个空列仅存储列的长度(0)。ORACLE不存储空列的数据。同时对于尾列的空列,ORACLE

甚至不存储列的长度。

原创粉丝点击