Oracle分区表range单分区

分区类型:rang、list、hash

sql语句:select partitioning_type, subpartitioning_type,partition_count from user_part_tables  where table_name ='RANGE_PART_TAB';

子分区:range-range、list-list、list-hash、list-range

分区总数:select partition_count from user_part_tables where table_name='表名';

 在哪一个列上建分区:

 select column_name, object_type, column_position from user_part_key_columns where name='RANGE_PART_TAB';

分区到底有多大:

select sum(bytes)/1024/1024 from user_segments where segment_name='RANGE_PART_TAB';

有多少个分区:

select partition_name,segment_type,bytes from user_segments where segment_name='RANGE_PART_TAB';

分区表的统计信息收集情况:

select table_name,partition_name,last_analyzed,partition_position,num_rows from user_tab_statistics t where table_name='RANGE_PART_TAB';

查该分区表有无索引,分别什么类型,全局索引是否失效,此外还可看统计信息收集情况:

select table_name,index_name,last_analyzed,blevel,num_rows,leaf_blocks,distinct_keys,status from user_indexes where table_name='RANGE_PART_TAB';

(N/A代表局部索引,否则就是全局索引)

分区表在哪些列上建了索引:

select index_name,column_name,column_position from user_ind_columns where table_name='RANGE_PART_TAB';

该分区表上的各索引分别有多大:

SQL> select segment_type,sum(bytes)/1024/1024 M  from user_segments where segment_name in (select index_name from user_indexes where table_name='RANGE_PART_TAB') group by segment_name,segment_type;

该分区表的索引段的分配情况:

select segment_name,partition_name,segment_type,bytes

  from user_segments

 where segment in (

   select index_name from user_indexes where table_name='RANGE_PART_TAB');

分区索引相关信息及统计信息、是否失效查看:

select t2.table_name,
          t1.index_name,
          t1.partition_name,
          t1.last_analyzed,
          t1.blevel,
          t1.num_rows,
          t1.leaf_blocks,
          t1.status
from user_ind_partitions t1, user_indexes t2
where t1.index_name = t2.index_name
and t2.table_name='RANGE_PART_TAB';

下一篇:range联合分区

原文地址:https://www.cnblogs.com/yangyanhao/p/7867269.html