create table進階學習系列(十一)之cluster
本文測試cluster table
---語法
CLUSTER cluster (column [, column ]...)
---cluster子句語義
CLUSTER Clause
---cluster標明建立表是cluster一部分; column是建立表的列且要和cluster column對應;cluster column是由構成主鍵的列或部分列組成;
The CLUSTER clause indicates that the table is to be part of cluster. The columns listed in this clause are the table columns
that correspond to the cluster columns. Generally, the cluster columns of a table are the column or columns that make up its primary
key or a portion of its primary key. Refer to CREATE CLUSTER for more information.---報錯cluster不存在,先要建立cluster
--- 未完全理解
Specify one column from the table for each column in the cluster key. The columns are matched by position, not by name.
Specify one column from the table for each column in the cluster key. The columns are matched by position, not by name.
---cluster table它使用cluster的儲存分配資訊,因此不能使用pctfree,pctused,initrans,tablespace
A cluster table uses the space allocation of the cluster. Therefore, do not use the PCTFREE, PCTUSED, or INITRANS parameters,
the TABLESPACE clause, or the storage_clause with the CLUSTER clause.
--cluster table操作限制
Restrictions on Cluster Tables Cluster tables are subject to the following restrictions:
A cluster table uses the space allocation of the cluster. Therefore, do not use the PCTFREE, PCTUSED, or INITRANS parameters,
the TABLESPACE clause, or the storage_clause with the CLUSTER clause.
--cluster table操作限制
Restrictions on Cluster Tables Cluster tables are subject to the following restrictions:
---物件表或包含lob列的表不能是cluster的一部分
Object tables and tables containing LOB columns or columns of the Any* Oracle-supplied types cannot be part of a cluster.
----你不能為cluster table指定parallel或cache
You cannot specify the parallel_clause or CACHE or NOCACHE for a table that is part of a cluster.
----不能指定rowdependencies或norowdependencies,除非cluster建立指定了相同的owdependencies或norowdependencies配置資訊
You cannot specify CLUSTER with either ROWDEPENDENCIES or NOROWDEPENDENCIES unless the cluster has been created with the same
ROWDEPENDENCIES or NOROWDEPENDENCIES setting.
---報錯因cluster不存在
SQL> create table t_test(a int) cluster cluster1 (a);
create table t_test(a int) cluster cluster1 (a)
ORA-00943: cluster does not exist
SQL>
Object tables and tables containing LOB columns or columns of the Any* Oracle-supplied types cannot be part of a cluster.
----你不能為cluster table指定parallel或cache
You cannot specify the parallel_clause or CACHE or NOCACHE for a table that is part of a cluster.
----不能指定rowdependencies或norowdependencies,除非cluster建立指定了相同的owdependencies或norowdependencies配置資訊
You cannot specify CLUSTER with either ROWDEPENDENCIES or NOROWDEPENDENCIES unless the cluster has been created with the same
ROWDEPENDENCIES or NOROWDEPENDENCIES setting.
---報錯因cluster不存在
SQL> create table t_test(a int) cluster cluster1 (a);
create table t_test(a int) cluster cluster1 (a)
ORA-00943: cluster does not exist
SQL>
---cluster的兩種型別:
---cluster也是一種物件型別,和table一樣.它如同容器一般,可包含多個table
Use the CREATE CLUSTER statement to create a cluster. A cluster is a schema object that contains data from one or more tables.
------cluster的第一種型別叫index cluster,必須包含多個表;且每個表有一個或多個列;
An index cluster must contain more than one table, and all of the tables in the cluster have one or more columns in common.
---oracle把cluster中所有表的記錄儲存在一起,共享相同的鍵值列;
Oracle Database stores together all the rows from all the tables that share the same cluster key.
-------cluster第二種型別是hash cluster,它包含1或多個表,oracle把這些表的記錄儲存在一起,它們擁有相同的hash key value
In a hash cluster, which can contain one or more tables, Oracle Database stores together rows that have the same hash key value.
------create cluster語法
CREATE CLUSTER [ schema. ] cluster
(column datatype [ SORT ]
[, column datatype [ SORT ] ]...
)
[ { physical_attributes_clause
| SIZE size_clause
| TABLESPACE tablespace
| { INDEX
| [ SINGLE TABLE ]
HASHKEYS integer [ HASH IS expr ]
}
}...
]
[ parallel_clause ]
[ NOROWDEPENDENCIES | ROWDEPENDENCIES ]
[ CACHE | NOCACHE ] ;
CREATE CLUSTER [ schema. ] cluster
(column datatype [ SORT ]
[, column datatype [ SORT ] ]...
)
[ { physical_attributes_clause
| SIZE size_clause
| TABLESPACE tablespace
| { INDEX
| [ SINGLE TABLE ]
HASHKEYS integer [ HASH IS expr ]
}
}...
]
[ parallel_clause ]
[ NOROWDEPENDENCIES | ROWDEPENDENCIES ]
[ CACHE | NOCACHE ] ;
---建立cluster
SQL> create cluster cluster1(a int) size 512 storage(initial 100k next 50k);
Cluster created
SQL> create cluster cluster1(a int) size 512 storage(initial 100k next 50k);
Cluster created
--建立cluster index
SQL> create index idx_cluster1 on cluster cluster1;
Index created
---新增table到cluster,cluster最多可包含32個表
SQL> create table t_test(a int) cluster cluster1 (a);
Table created
SQL> create index idx_cluster1 on cluster cluster1;
Index created
---新增table到cluster,cluster最多可包含32個表
SQL> create table t_test(a int) cluster cluster1 (a);
Table created
---lob列的表不能新增到cluster中
SQL> create table t_test_lob(a int,b blob) cluster cluster1(a);
create table t_test_lob(a int,b blob) cluster cluster1(a)
ORA-03001: unimplemented feature
SQL> create table t_test_lob(a int,b clob) cluster cluster1(a);
create table t_test_lob(a int,b clob) cluster cluster1(a)
ORA-03001: unimplemented feature
SQL> create table t_test_lob(a int,b blob) cluster cluster1(a);
create table t_test_lob(a int,b blob) cluster cluster1(a)
ORA-03001: unimplemented feature
SQL> create table t_test_lob(a int,b clob) cluster cluster1(a);
create table t_test_lob(a int,b clob) cluster cluster1(a)
ORA-03001: unimplemented feature
---查詢cluster資訊
SQL> desc user_clusters;
Name Type Nullable Default Comments
------------------ ------------ -------- ------- -----------------------------------------------------------------
CLUSTER_NAME VARCHAR2(30) Name of the cluster
TABLESPACE_NAME VARCHAR2(30) Name of the tablespace containing the cluster
PCT_FREE NUMBER Y Minimum percentage of free space in a block
PCT_USED NUMBER Y Minimum percentage of used space in a block
KEY_SIZE NUMBER Y Estimated size of cluster key plus associated rows
INI_TRANS NUMBER Initial number of transactions
MAX_TRANS NUMBER Maximum number of transactions
INITIAL_EXTENT NUMBER Y Size of the initial extent in bytes
NEXT_EXTENT NUMBER Y Size of secondary extents in bytes
MIN_EXTENTS NUMBER Minimum number of extents allowed in the segment
MAX_EXTENTS NUMBER Maximum number of extents allowed in the segment
PCT_INCREASE NUMBER Y Percentage increase in extent size
FREELISTS NUMBER Y Number of process freelists allocated in this segment
FREELIST_GROUPS NUMBER Y Number of freelist groups allocated in this segment
AVG_BLOCKS_PER_KEY NUMBER Y Average number of blocks containing rows with a given cluster key
CLUSTER_TYPE VARCHAR2(5) Y Type of cluster: b-tree index or hash
FUNCTION VARCHAR2(15) Y If a hash cluster, the hash function
HASHKEYS NUMBER Y If a hash cluster, the number of hash keys (hash buckets)
DEGREE VARCHAR2(40) Y The number of threads per instance for scanning the cluster
INSTANCES VARCHAR2(40) Y The number of instances across which the cluster is to be scanned
CACHE VARCHAR2(20) Y Whether the cluster is to be cached in the buffer cache
BUFFER_POOL VARCHAR2(7) Y The default buffer pool to be used for cluster blocks
FLASH_CACHE VARCHAR2(7) Y The default flash cache hint to be used for cluster blocks
CELL_FLASH_CACHE VARCHAR2(7) Y The default cell flash cache hint to be used for cluster blocks
SINGLE_TABLE VARCHAR2(20) Y Whether the cluster can contain only a single table
DEPENDENCIES VARCHAR2(8) Y Should we keep track of row level dependencies?
SQL> desc user_clusters;
Name Type Nullable Default Comments
------------------ ------------ -------- ------- -----------------------------------------------------------------
CLUSTER_NAME VARCHAR2(30) Name of the cluster
TABLESPACE_NAME VARCHAR2(30) Name of the tablespace containing the cluster
PCT_FREE NUMBER Y Minimum percentage of free space in a block
PCT_USED NUMBER Y Minimum percentage of used space in a block
KEY_SIZE NUMBER Y Estimated size of cluster key plus associated rows
INI_TRANS NUMBER Initial number of transactions
MAX_TRANS NUMBER Maximum number of transactions
INITIAL_EXTENT NUMBER Y Size of the initial extent in bytes
NEXT_EXTENT NUMBER Y Size of secondary extents in bytes
MIN_EXTENTS NUMBER Minimum number of extents allowed in the segment
MAX_EXTENTS NUMBER Maximum number of extents allowed in the segment
PCT_INCREASE NUMBER Y Percentage increase in extent size
FREELISTS NUMBER Y Number of process freelists allocated in this segment
FREELIST_GROUPS NUMBER Y Number of freelist groups allocated in this segment
AVG_BLOCKS_PER_KEY NUMBER Y Average number of blocks containing rows with a given cluster key
CLUSTER_TYPE VARCHAR2(5) Y Type of cluster: b-tree index or hash
FUNCTION VARCHAR2(15) Y If a hash cluster, the hash function
HASHKEYS NUMBER Y If a hash cluster, the number of hash keys (hash buckets)
DEGREE VARCHAR2(40) Y The number of threads per instance for scanning the cluster
INSTANCES VARCHAR2(40) Y The number of instances across which the cluster is to be scanned
CACHE VARCHAR2(20) Y Whether the cluster is to be cached in the buffer cache
BUFFER_POOL VARCHAR2(7) Y The default buffer pool to be used for cluster blocks
FLASH_CACHE VARCHAR2(7) Y The default flash cache hint to be used for cluster blocks
CELL_FLASH_CACHE VARCHAR2(7) Y The default cell flash cache hint to be used for cluster blocks
SINGLE_TABLE VARCHAR2(20) Y Whether the cluster can contain only a single table
DEPENDENCIES VARCHAR2(8) Y Should we keep track of row level dependencies?
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-753248/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- create table進階學習系列(十一)之cluster_續(二)
- create table進階學習系列(八)
- create table進階學習系列(五)
- create table進階學習系列(七)
- create table進階學習系列(九)
- create table進階學習(一)
- create table進階學習(三)
- create table進階學習(四)
- create table進階學習(二)_全域性臨時表_global temporary table
- create table進階學習(二)_dba_free_temp_space_v$tempseg_usage_v$sort_segment
- 《大前端進階 Node.js》系列 雙十一秒殺系統(進階必看)前端Node.js
- (十一)TestNG學習之路—BeanShell高階用法Bean
- Node進階學習
- oracle create table官方手冊如何快速檢視學習方法Oracle
- Java進階學習之Java架構師的學習路線Java架構
- Python進階學習之程式碼閱讀Python
- Java進階學習之集合與泛型(1)Java泛型
- oracle學習筆記(十一) 高階查詢Oracle筆記
- .NET進階系列之四:深入DataTable
- Java進階容器學習Java
- create table之storage選項initial和其它
- hive學習筆記之十一:UDTFHive筆記
- JUnit5學習之八:綜合進階(終篇)
- Python進階學習分享之迴圈設計Python
- Hive學習之六 《Hive進階— —hive jdbc》 詳解HiveJDBC
- create table of mysql databaseMySqlDatabase
- Go語言核心36講(Go語言進階技術十一)--學習筆記Go筆記
- 小丸子學MongoDB系列之——部署Replica Set+Sharded ClusterMongoDB
- Go 進階學習筆記Go筆記
- Java學習路線·進階Java
- c++學習進階之路
- Swift進階學習筆記Swift筆記
- Git進階學習筆記Git筆記
- JavaScript學習8:DOM進階JavaScript
- ReactNative學習筆記十一之FlatListReact筆記
- Tutorial: Create SQL Cluster(FCI) on RHELSQL
- 快速學習nodejs系列:十一、nodejs垃圾回收NodeJS
- Python爬蟲學習之(二)| urllib進階篇Python爬蟲