cluster table
A table cluster is a group of tables that share common columns and store related data
in the same blocks. When tables are clustered, a single data block can contain rows
from multiple tables. For example, a block can store rows from both the employees and
departments tables rather than from only a single table.
----oracle 簇表在一个块中存储多个表中 相同的列和存储相关数据
The cluster key is the column or columns that the clustered tables have in common.
---聚簇键是表中相同的列(一个或者多个)
The cluster key value is the value of the cluster key columns for a particular set of
rows. All data that contains the same cluster key value, such as department_id=20, is
physically stored together. Each cluster key value is stored only once in the cluster and
the cluster index, no matter how many rows of different tables contain the value.
Indexed Clusters table ---索引聚簇表
An indexed cluster is a table cluster that uses an index to locate data. The cluster
index is a B-tree index on the cluster key. A cluster index must be created before any
rows can be inserted into clustered tables.
---索引聚簇表使用索引定位数据。在聚簇值上使用b*索引。必须在插入数据之前创建聚簇索引(cluster index)
A hash cluster is like an indexed cluster, except the index key is replaced with a hash
function . No separate cluster inde x exists. In a hash cluster, the data is the index.
With an indexed table or indexed cluster, Oracle Database locates table rows using key
values stored in a separate index. To find or store a row in an indexed table or table
cluster, the database must perform at least two I/Os:
■ One or more I/Os to find or store the key value in the index
■ Another I/O to read or write the row in the table or table cluster
To find or store a row in a hash cluster, Or acle Database applies the hash function to
the cluster key value of the row. The resulting hash value corresponds to a data block
in the cluster, which the database reads or writes on behalf of the issued statement.
---哈希聚簇表和索引聚簇表类似,只是使用了哈希函数代替了索引键。在哈希簇中,数据就是索引。
---使用索引的表或者索引聚簇表。oracle使用一个单独存储的索引。
---使用哈希聚簇表,查找或者存储行,oracle会利用对cluster key 使用哈希函数。将cluster key转换为数据块地址
簇是oracle中的段,主要完成以下两件事:
1、通过公共键物理的将数据存放一起。数据并没有排序。
2、允许将来自多个数据库表的数据存储在相同的物理数据库块中。
使用cluster 的好处:
将数据物理的存储在一起表示可以在相同的数据块中存放来自许多表的行。所有表共享一个cluster table index
减少了索引的需求。
使用cluster有两个基本限制
1、不能进行cluster的直接路径装载
2、不能分区cluster table
数据字典中的主表是以b*tree 索引聚簇表存储的
sys@ORCL> select cluster_name,owner,table_name from
2 dba_tables where cluster_name is not null
3 order by cluster_name;
CLUSTER_NAME
------------------------------------------------------------------------------------------
OWNER TABLE_NAME
------------------------------ ------------------------------
C_COBJ#
SYS CCOL$
C_COBJ#
SYS CDEF$
C_FILE#_BLOCK#
SYS UET$
C_FILE#_BLOCK#
SYS SEG$
C_MLOG#
SYS SLOG$
C_MLOG#
SYS MLOG$
C_OBJ#
SYS REFCON$
C_OBJ#
SYS NTAB$
C_OBJ#
SYS SUBCOLTYPE$
c_cobj# 有两个表。表示有两个表中的行可以保存在单个数据块中。全都由他们的公共键prejoined。在oracle
需要查找一个对象的信息时,可能就只需要做一个物理I/O从16张表中读出所有信息。