在整个系统的压力测试下,下面这句SQl语句占用资源比较大,已经将trtp,ctof,trdt,idno加了索引,
但效率还是上不去,请问怎么样能优化一下,使效率提高呢?select sum(slam) as slam from trd_tranlist_"
+ ptid + " where trtp='1' "
+ "and ctof ='0' and trdt = ? and idno=?
但效率还是上不去,请问怎么样能优化一下,使效率提高呢?select sum(slam) as slam from trd_tranlist_"
+ ptid + " where trtp='1' "
+ "and ctof ='0' and trdt = ? and idno=?
字段的顺序是,过滤数据量最多的字段放在where条件最后面。
这样可以提高效率
哈哈,话说前段时间我面试的时候就被问过这个问题,驱动表和where条件顺序在CBO中有没有作用。
这样可以提高效率,引用四楼的话.
这样每次都是硬解析
如果没有用到 就用强制索引 /*+ index(索引名) */