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


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