1:When creating a hash cluster, if the hashkeys is not a prime number, then oracle will use the next nearest prime number as the hashkeys.
2: When creating a table in the hash cluster, as the cluster is already pre-allocated, so we could see the table will take space even if there is no data inside.
SQL> create cluster hash_cluster ( hash_key number(10) )
2 hashkeys 1000
3 size 1200
4 single table
5 hash is HASH_KEY;
Cluster created
SQL> select a.cluster_name,a.hashkeys from user_clusters a where a.cluster_name='HASH_CLUSTER';
CLUSTER_NAME HASHKEYS
------------------------------ ----------
HASH_CLUSTER 1009 ===> 1009 is used instead of 1000
SQL> create table t_hashed
2 (a number(10) primary key, b char(1000))
3 cluster hash_cluster(a);
Table created
SQL> set serveroutput on
SQL> exec show_space('T_HASHED');
Free Blocks.............................0
Total Blocks............................256
Total Bytes.............................2097152
Unused Blocks...........................86
Unused Bytes............................704512
Last Used Ext FileId....................6
Last Used Ext BlockId...................28169
Last Used Block.........................42
PL/SQL procedure successfully completed
SQL> select count(*) from T_HASHED;
COUNT(*)
----------
0 ===> no data, but table already takes space
没有评论:
发表评论