Select 1 from fexpense e, fconsign c, csubchargeitem s, ccustsuppview csv, cuser cu1, cuser cu2 where (e.fexp_creator = ? or exists (select f.FCSG_CONSIGN_ID from FCONSIGN f where f.fcsg_consign_id=e.fexp_consign_id and f.fcsg_creator = :"SYS_B_04"))
and e.fexp_consign_id = c.fcsg_consign_id(+) and e.fexp_charge_id = s.csci_ci_id(+) and e.fexp_settlerment_object = csv.accountNumber(+) and c.fcsg_creator = cu1.cusr_user_id(+) and c.fcsg_canvasser = cu2.cusr_user_id(+) and (e.fexp_forward_flag > ? or e.fexp_forward_flag < ?) and (e.fexp_cancel_flag > ?or e.fexp_cancel_flag < ?) and (e.fexp_lump_flag > ?or e.fexp_lump_flag < ?) and e.fexp_org_id = ? order by e.fexp_settlerment_object ASC, e.fexp_currency_code ASC看了执行计划,提示fexpense表做了全表扫描,我对该表的WHERE条件中的字段做了个联合索引,还是提示全表,有什么解决办法
and e.fexp_consign_id = c.fcsg_consign_id(+) and e.fexp_charge_id = s.csci_ci_id(+) and e.fexp_settlerment_object = csv.accountNumber(+) and c.fcsg_creator = cu1.cusr_user_id(+) and c.fcsg_canvasser = cu2.cusr_user_id(+) and (e.fexp_forward_flag > ? or e.fexp_forward_flag < ?) and (e.fexp_cancel_flag > ?or e.fexp_cancel_flag < ?) and (e.fexp_lump_flag > ?or e.fexp_lump_flag < ?) and e.fexp_org_id = ? order by e.fexp_settlerment_object ASC, e.fexp_currency_code ASC看了执行计划,提示fexpense表做了全表扫描,我对该表的WHERE条件中的字段做了个联合索引,还是提示全表,有什么解决办法
解决方案 »
- 这是Oracle和Linux的结合 请大家帮帮忙
- ORACLE 10g怎么在vista系统下安装不了
- 一个关于Oracle的ODBC问题
- 当有大量数据需要查询的时候,要如何做呢?
- A表两个KEY,B表一个KEY,两个表结合显示,B表就会有许多数据重复,想把重复的数据设为空,怎么写SQL好啊
- 如何查询ORACLE中某一时间段内的删除操作记录
- 怎样取出查询数据的前100行,在线等,立即结帖
- 如何动态执行语句?如: EXE 'UPDATE T_TABLE SET ,,,,,'
- 如何扩展SQL命令?
- oracle?搞什么鬼???
- insert语句问题
- oracle/dms/instrument/ExecutionContextForJDBC的问题
(e.fexp_creator = ? or e.fexp_creator in (select f.FCSG_CONSIGN_ID from FCONSIGN f where f.fcsg_creator = :"SYS_B_04"))
这样,就会用fexpense的fexp_creator索引了
还有这个SQL语句要怎么建立索引来避免fconsign全表扫描
在where 之后
先写 表关联
然后是 从后往前 查询的是对的吗?
那索引的顺序和SQL的顺序正好相反,是吗?
我执行
select 1 from tab t where t.a=:"1"和
select 1 from tab t where t.b=:"1"
看执行计划,第一条有用到索引,第二条没有索引是什么原因??
Analyze Table fexpense compute Statistics; ---更新数据统计
还是不行,COST成本反而增加了些急救。。