partition_global index補疑(一)
----建立分割槽表
SQL> create table t_partition(a int,b int)
2 partition by range(a)
3 (partition p1 values less than(10),
4 partition p2 values less than(20),
5 partition p3 values less than(maxvalue)
6 )
7 /
SQL> create table t_partition(a int,b int)
2 partition by range(a)
3 (partition p1 values less than(10),
4 partition p2 values less than(20),
5 partition p3 values less than(maxvalue)
6 )
7 /
Table created.
--在分割槽表建立普通唯一索引
SQL> create unique index idx_t_partition on t_partition(a);
Index created.
-普通唯一索引未分割槽
SQL> select index_name,partition_name from user_ind_partitions where index_name=
(select index_name from user_indexes where table_name='T_PARTITIOIN');
SQL> select index_name,partition_name from user_ind_partitions where index_name=
(select index_name from user_indexes where table_name='T_PARTITIOIN');
no rows selected
SQL> drop index idx_t_partition;
Index dropped.
SQL> create index idx_t_partition on t_partition(a) local;
Index created.
SQL> select index_name,partition_name from user_ind_partitions where index_name
(select index_name from user_indexes where table_name='T_PARTITIOIN');
(select index_name from user_indexes where table_name='T_PARTITIOIN');
no rows selected
SQL> select index_name,partition_name from user_ind_partitions where index_name
(select index_name from user_indexes where table_name='T_PARTITION');
(select index_name from user_indexes where table_name='T_PARTITION');
INDEX_NAME
------------------------------------------------------------
PARTITION_NAME
------------------------------------------------------------
IDX_T_PARTITION
P2
------------------------------------------------------------
PARTITION_NAME
------------------------------------------------------------
IDX_T_PARTITION
P2
IDX_T_PARTITION
P1
P1
IDX_T_PARTITION
P3
P3
---建立全域性索引
SQL> create unique index idx_t_partition on t_partition(a) global;
SQL> create unique index idx_t_partition on t_partition(a) global;
Index created.
---建立的全域性索引未分割槽
SQL> select index_name,partition_name from user_ind_partitions where index_name=
(select index_name from user_indexes where table_name='T_PARTITION');
SQL> select index_name,partition_name from user_ind_partitions where index_name=
(select index_name from user_indexes where table_name='T_PARTITION');
no rows selected
SQL>
SQL> select index_name,status from user_indexes where table_name='T_PARTITION';
INDEX_NAME STATUS
------------------------------------------------------------ ----------------
IDX_T_PARTITION VALID
------------------------------------------------------------ ----------------
IDX_T_PARTITION VALID
SQL> select * from t_partition partition(p1);
A B
---------- ----------
2 1
---------- ----------
2 1
SQL> alter table t_partition truncate partition p1;
Table truncated.
---全域性索引維護分割槽會失效
SQL> select index_name,status from user_indexes where table_name='T_PARTITION';
SQL> select index_name,status from user_indexes where table_name='T_PARTITION';
INDEX_NAME STATUS
------------------------------------------------------------ ----------------
IDX_T_PARTITION UNUSABLE
------------------------------------------------------------ ----------------
IDX_T_PARTITION UNUSABLE
SQL> create index idx_t_partition on t_partition(a) local;
Index created.
SQL> desc t_partition;
Name Null? Type
----------------------------------------- -------- -------------
Name Null? Type
----------------------------------------- -------- -------------
A NUMBER(38)
B NUMBER(38)
B NUMBER(38)
SQL> alter table t_partition modify b not null;
Table altered.
SQL> create index idx_pk_global on t_partition(b)
2 global
3 partition by range(b)
4 (partition p1 values less than (10),
5 partition p2 values less than (20),
6 partition p3 values less than (maxvalue)
7 )
8 /
Index created.
2 global
3 partition by range(b)
4 (partition p1 values less than (10),
5 partition p2 values less than (20),
6 partition p3 values less than (maxvalue)
7 )
8 /
Index created.
---全域性索引以分割槽鍵進行分割槽
SQL> select index_name,partition_name from user_ind_partitions where index_nam
'IDX_PK_GLOBAL';
INDEX_NAME
------------------------------------------------------------
PARTITION_NAME
------------------------------------------------------------
IDX_PK_GLOBAL
P1
IDX_PK_GLOBAL
P2
IDX_PK_GLOBAL
P3
SQL> select index_name,partition_name from user_ind_partitions where index_nam
'IDX_PK_GLOBAL';
INDEX_NAME
------------------------------------------------------------
PARTITION_NAME
------------------------------------------------------------
IDX_PK_GLOBAL
P1
IDX_PK_GLOBAL
P2
IDX_PK_GLOBAL
P3
---全域性索引也可僅指定global建立
SQL> create index idx_pk_global on t_partition(b) global;
SQL> create index idx_pk_global on t_partition(b) global;
Index created.
SQL>
---不指定global後的分割槽,全域性索引不分割槽
SQL> select index_name,partition_name from user_ind_partitions where index_name=
'IDX_PK_GLOBAL'
2 /
SQL> select index_name,partition_name from user_ind_partitions where index_name=
'IDX_PK_GLOBAL'
2 /
no rows selected
SQL> select index_name from user_indexes where index_name='IDX_PK_GLOBAL';
INDEX_NAME
------------------------------------------------------------
IDX_PK_GLOBAL
------------------------------------------------------------
IDX_PK_GLOBAL
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-752361/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 前端除錯:記Iscroll4 疑難雜症之z-index失效前端除錯Index
- 【摘錄】index(一)Index
- Index R 時序數倉技術架構(待補充)Index架構
- asynchttpclient 使用的一點疑問HTTPclient
- 開源疑問知多少(一)
- 前端面試查漏補缺--Index篇(12萬字元合集)前端面試Index字元
- oracle index索引結構(一)OracleIndex索引
- oracle dml與索引index(一)Oracle索引Index
- 唯一index和非唯一index中leaf node裡rowid的一點區別。Index
- 有關事件的一點疑問事件
- KEEP INDEX | DROP INDEXIndex
- mysql oder by 使用index一例MySqlIndex
- Index internal 結構 試驗一Index
- 對技術的一些疑問
- 在學習中的一點疑問。
- 對機器學習的一些懷疑理由機器學習
- 對 ForumThread 建模的一點疑問thread
- 檔案操作的一些疑問
- [20220309]查詢x$ksmmem遇到的疑問補充.txt
- index 和 index_desc hints的一點有意思的區別Index
- 唯一性索引(Unique Index)與普通索引(Normal Index)差異(上)索引IndexORM
- 唯一性索引(Unique Index)與普通索引(Normal Index)差異(中)索引IndexORM
- 唯一性索引(Unique Index)與普通索引(Normal Index)差異(下)索引IndexORM
- rowid,index,INDEX FULL SCAN,INDEX FAST FULL SCAN|IndexAST
- 疑問:使用find_elements_by_ios_predicate定位元素組,獲取元素的index沒有按照順序iOSIndex
- Oracle index 使用的一個總結OracleIndex
- Index Joins的一點測試!Index
- bitmap index點陣圖索引系列(一)Index索引
- INDEX UNIQUE SCAN,INDEX FULL SCAN和INDEX FAST FULL SCANIndexAST
- 敲程式碼時的一個小疑問
- 對一個執行計劃的疑問
- ValueObject和DTO模式的一些疑問Object模式
- JUnit原始碼中有一點疑問,請教原始碼
- jbuilder7+jboss3一文疑問!UIS3
- Clustered Index Scan and Clustered Index SeekIndex
- Oracle補丁介紹一Oracle
- 資料修補一則
- oracle hint之full,index,index_asc,index_desc,index_combile示例OracleIndex