本帖最后由 wshiyc 于 2012-05-18 14:38:56 编辑

解决方案 »

  1.   

    你的查询语句经常使用的查询条件是时间?
    还是TID?
    -- Create/Recreate indexes 
    create index IDX_table1 on table (ENTRY_ID)
      tablespace TBS_01;
    create index IDX_table2 on table (AUTHORG)
      tablespace TBS_01;
    create index IDX_table3 on table (old_tid)
      tablespace TBS_01;
    create index IDX_table4 on table (pub_tid)
      tablespace TBS_01;
    create index IDX_table5 on table (batch1)
      tablespace TBS_01;
    create index IDX_table6 on table (ORG)
      tablespace TBS_01;
    create index IDX_table7 on table (batch2)
      tablespace TBS_01;
    create index IDX_table8 on table (ID)
      tablespace TBS_01;
    create index IDX_table9 on table (arcsid)
      tablespace TBS_01;你竟然在所有的字段上都建立了索引,当场吐血。
    你经常用到的查询字段上建立索引。。
      

  2.   

    3、表做成分区表(按照date范围分区),索引做成全局分区索引(前缀)
    4、表做成分区表(按照date范围分区),索引做成本地非前缀索引--创建分区表和分区索引
    创建表:
    create table test(
     c1 int,
     c2 varchar2(16),
     c3 varchar2(64),
     c4 int
     constraint pk_ta_c1 primary key(c1)
    )partition by range(c1)(
     partition p1 values less than(10000000),
     partition p2 values less than(20000000),
     partition p3 values less than(30000000),
     partition p4 values less than(maxvalue)
    );
    建立分区索引:
    create index idx_test_c2 on test(c2) local (partition p1,partition p2,partition p3,parition p4);
    或者create index idx_test_c2 on test(c2) local;索引数量还是需要控制一下,不能每个字段都建立吧。一般都是建立一个新索引,做一下表的INSERT 操作,如果时间很长,该索引最好不要建立。除非是查询速度有严格要求,只能牺牲业务操作时间。
      

  3.   

    可以用个组合分区,
    先按时间建个区间分区,(eg:一月一个),然后在该区间分区下再建hash分区。索引的话,建议用局部的就好了,毕竟全局索引的话有点风险,万一一个索引出问题了,整个表的访问都是问题。
      

  4.   

    经常使用的查询条件是TID,最近有根据时间范围查询的交易响应很慢。
    也不是所有的字段,这个表有很多其他字段,我把有索引的字段摘出来了方便看。