分區表、分區索引和全局索引


1.分區表例子:

create table t_partition_range (id number,name varchar2(50))

    partition by range(id)(

    partition t_range_p1 values less than (10) tablespace tbspart01,

    partition t_range_p2 values less than (20) tablespace tbspart02,

    partition t_range_p3 values less than (30) tablespace tbspart03,

    partition t_range_pmax values less than (maxvalue) tablespace tbspart04

    );

----select * from user_part_tables:記錄分區的表的信息;

---select * user_tab_partitions:記錄表的分區的信息。

---SYS.SYSHPARTTABLEINFO  分區表信息。

2.全局索引

create index idx_parti_range_id on t_partition_range(id)

global partition by range(id)(

  partition i_range_p1 values less than (10) tablespace tbspart01,

    partition i_range_p2 values less than (20) tablespace tbspart02,

    partition i_range_p3 values less than (30) tablespace tbspart03,

    partition i_range_pmax values less than (maxvalue) tablespace tbspart04

);

3.分區索引

create index IDX_PARTI_RANGE_ID on T_PARTITION_RANGE(id) local;

或者

create index IDX_PART_RANGE_ID ON T_PARTITION_RANGE(id) local (

partition i_range_p1 tablespace tbspart01,

 partition i_range_p2 tablespace tbspart01,

 partition i_range_p3 tablespace tbspart02,

 partition i_range_pmax tablespace tbspart02

 );

 

筆記參考:

https://wenku.baidu.com/view/08a2644eecfdc8d376eeaeaad1f34693dbef1053.html

https://blog.csdn.net/qq_21909121/article/details/80972084

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM