为1.7亿张记录表创建快速索引
2007-05-10 12:16:25 来源:WEB开发网核心提示:本文讲述了在大表上创建索引需要注意的事项,以及整个过程,为1.7亿张记录表创建快速索引,需求:在STAT_SUBMIT_CENTER表的RECORDTIME字段上面创建一索引, 环境:SunOS 5.9 oracle 9204 8 cpu 3G mem1. 查看表的具体情况是不是分区表
本文讲述了在大表上创建索引需要注意的事项,以及整个过程。
需求:在STAT_SUBMIT_CENTER表的RECORDTIME字段上面创建一索引。 环境:SunOS 5.9 oracle 9204 8 cpu 3G mem1. 查看表的具体情况
是不是分区表,有多少个分区,分区字段:
SQL> col table_name for a20SQL> col column_name for a20SQL> select a.table_name,a.partitioned,b.partition_count,c.column_name 2 from user_tables a, user_part_tables b, user_part_key_columns c 3 where a.table_name='STAT_SUBMIT_CENTER' 4 and b.table_name='STAT_SUBMIT_CENTER' 5 and c.name='STAT_SUBMIT_CENTER';TABLE_NAME PAR PARTITION_COUNT COLUMN_NAME-------------------- --- --------------- --------------------STAT_SUBMIT_CENTER YES 50 MSGDATE
已使用的每个分区的大小:
SQL> select segment_name,partition_name,round(bytes/1024/1024) from user_segments where segment_name ='STAT_SUBMIT_CENTER' and bytes/1024/1024>0.25 order by 3 desc;SEGMENT_NAME PARTITION_NAME ROUND(BYTES/1024/1024)-------------------------- ------------------------------ ----------------------STAT_SUBMIT_CENTER STAT_SUBMIT_CENTER_20051101 1722STAT_SUBMIT_CENTER STAT_SUBMIT_CENTER_20051021 1488STAT_SUBMIT_CENTER STAT_SUBMIT_CENTER_20051111 1440STAT_SUBMIT_CENTER STAT_SUBMIT_CENTER_20051121 1355STAT_SUBMIT_CENTER STAT_SUBMIT_CENTER_20051221 1335STAT_SUBMIT_CENTER STAT_SUBMIT_CENTER_20050911 1309STAT_SUBMIT_CENTER STAT_SUBMIT_CENTER_20051211 1253STAT_SUBMIT_CENTER STAT_SUBMIT_CENTER_20051201 1247STAT_SUBMIT_CENTER STAT_SUBMIT_CENTER_20050921 1198STAT_SUBMIT_CENTER STAT_SUBMIT_CENTER_20060101 1151STAT_SUBMIT_CENTER STAT_SUBMIT_CENTER_20060111 1068STAT_SUBMIT_CENTER STAT_SUBMIT_CENTER_20051001 1018STAT_SUBMIT_CENTER STAT_SUBMIT_CENTER_20051011 865STAT_SUBMIT_CENTER STAT_SUBMIT_CENTER_20060121 79614 rows selected.
整个表的大小:
更多精彩
赞助商链接