关于Oracle关联算法的优化
小弟新学Oracle,哪位大侠帮忙给个算法,原始SQL如下
select a.saler,a.saledate,from saleinfo
inner join saveinfo sinfo on sinfo .app_order=a.app_order
and a.salemonth.=201001 and sinfo.factno='6901 4425 765 1'
and sinfo.salernot in
(
select a.saler,a.saledate,from saleinfo
inner join saveinfo sinfo on sinfo .app_order=a.app_order
and a.salemonth. <201001 and sinfo.factno='6901 4425 765 1'
)
这是最笨的方法了,执行效率太低了,库中一共400W的数据量,执行一次大概40分钟左右,求高人指点,万分感谢
你的sql满篇错误,改个格式你自己看看。
不过你的意思我看明白了大概,
1、在saleinfo的app_order字段建一个索引
2、salemonth和factno字段建一个组合索引
3、避免使用in查询,如果能替代换一个方式写
SQL code:
select a.saler,a.saledate,
from saleinfo inner join saveinfo sinfo
on sinfo.app_order = a.app_order
and a.salemonth. = 201001
and sinfo.factno = '6901 4425 765 1'
and sinfo.salernot in (
select a.saler,a.saledate,
from saleinfo inner join saveinfo sinfo
on sinfo.app_order = a.app_order
and a.salemonth < 201001
and sinfo.factno = '6901 4425 765 1'
)
还能
相关问答:
请问这个缓冲池是怎么回事啊?可以连接缓冲池利用其中的数据吧?怎么用?
这个是oracle自动做的,一般应用程序是操作不了的。
不能直接连接吗?
引用
不能直接连接吗?
不能
那缓冲池里的数据也不能查询 ......
在执行包的时候引用oracle spatial空间函数出错,出错情况如下
Errors in file
/user/oracle/app/oracle/admin/grid/udump/grid1_ora_143768.trc: ORA-29902:
error in executing ODCIIndexStart() routine ORA-0 ......
在系统运行的时候总是有一块磁盘始终闪红灯,进入系统后
#topas查看总是有一块磁盘%BUSY为90%以上,
数据库版本:oracle 9.2.0.7
数据文件挂载的节点:/oradata/pcs/ 逻辑卷号lv04
#lslv -l lv04
......
我有两个表(A表和B表),机构完全相同:A 表建立触发器
当insert into A(id,name) values('1','zhangsan'); 我只想将name=zhangsan的时候将insert语句插入到B表中而A表不执行操作这个触发器应该怎么实现呢?
如: ......