ITPub博客

首页 > IT基础架构 > 网络安全 > Overview of Hash Clusters (239)

Overview of Hash Clusters (239)

原创 网络安全 作者:tsinglee 时间:2007-11-21 11:54:11 0 删除 编辑

Hash clusters group table data in a manner similar to regular index clusters (clusters
keyed with an index rather than a hash function). However, a row is stored in a hash
cluster based on the result of applying a hash function to the row’s cluster key value.
All rows with the same key value are stored together on disk.

Hash clusters are a better choice than using an indexed table or index cluster when a
table is queried frequently with equality queries (for example, return all rows for
department 10). For such queries, the specified cluster key value is hashed. The
resulting hash key value points directly to the area on disk that stores the rows.

Hashing is an optional way of storing table data to improve the performance of data
retrieval. To use hashing, create a hash cluster and load tables into the cluster. Oracle
physically stores the rows of a table in a hash cluster and retrieves them according to
the results of a hash function.

Sorted hash clusters allow faster retrieval of data for applications where data is
consumed in the order in which it was inserted.

Oracle uses a hash function to generate a distribution of numeric values, called hash
values, which are based on specific cluster key values. The key of a hash cluster, like
the key of an index cluster, can be a single column or composite key (multiple column
key). To find or store a row in a hash cluster, Oracle applies the hash function to the
row’s cluster key value. The resulting hash value corresponds to a data block in the
cluster, which Oracle then reads or writes on behalf of the issued statement.

A hash cluster is an alternative to a nonclustered table with an index or an index
cluster. With an indexed table or index cluster, Oracle locates the rows in a table using
key values that Oracle stores in a separate index. To find or store a row in an indexed
table or cluster, at least two I/Os must be performed:
■ 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 cluster

哈希簇
1. 哈希簇中,一行数据的存储位置是依据此行的簇键值经过哈希函数运算所得的结果而决定的。拥有相同簇键
值的数据行在磁盘上的存储在一起。
2. 当一个表的数据经常使用等值条件进行查询时,以哈希簇的形式存储这些数据比在此表上创建索引或索引簇
更适用。Oracle处理查询时,可以对查询条件中的簇键值进行哈希运算,运算结果直接指向磁盘中存储相应数据行
3. 可以创建一个哈希簇 ,并将表数据加载到此簇中。之后 Oracle 就可以使用哈希函数的运算结果来访问数
据了。
4. 如果在一个应用中,查询数据的顺序与这些数据被插入时的顺序相同,那么使用经过排序的哈希簇能够提
高数据获取的速度。
5. Oracle 使用哈希函数根据簇键值生成一个分布式的数值,这个值被称为哈希值。哈希簇使用的键同索引簇
的类似,既可以由一列构成,也可以是复合键。Oracle 在存储或查找哈希簇中的一行数据时,需要使用此行的簇
键值进行哈希运算。运算结果直接对应着簇中的数据块内的物理地址,Oracle 就可以依此地址在数据块内为语句
进行读或写操作。
6. 利用非簇表及索引或索引簇存储的数据,也可以考虑使用哈希簇存储。对于使用索引或索引簇的非簇表,
Oracle 利用索引中的键值来定位数据行在表中的位置,此时至少需要执行
两次 I/O 操作:
* 一次或多次 I/O 操作,查找或存储索引中的键值
* 另一次 I/O 操作,读写表或簇中的数据行

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10599713/viewspace-983127/,如需转载,请注明出处,否则将追究法律责任。

下一篇: Hint : USE_CONCAT
请登录后发表评论 登录
全部评论
  • 博文量
    740
  • 访问量
    1897889