刚碰到一个问题
两个句子分别执行都很快
select sum(money) as paymoney, date
from [email protected]
and fee.date between date '2009-05-24' and date
'2009-05-24'
group by dateselect sum(money) as money, date
from temp
where date between date '2009-05-24' and date '2009-05-24'
group by date
基本都在5秒以内
但是如下面的写法就超慢
难道这样的查询是将所有数据传送到一端再做计算
不是只计算结果吗
select date
from (select sum(money) as paymoney, date
from [email protected]
and fee.date between date '2009-05-24' and date
'2009-05-24'
group by date
minus
select sum(money) as money, date
from temp
where date between date '2009-05-24' and date '2009-05-24'
group by date)
order by date大牛出下手,有其他解决方法没有啊
数据量在20w条左右
两个句子分别执行都很快
select sum(money) as paymoney, date
from [email protected]
and fee.date between date '2009-05-24' and date
'2009-05-24'
group by dateselect sum(money) as money, date
from temp
where date between date '2009-05-24' and date '2009-05-24'
group by date
基本都在5秒以内
但是如下面的写法就超慢
难道这样的查询是将所有数据传送到一端再做计算
不是只计算结果吗
select date
from (select sum(money) as paymoney, date
from [email protected]
and fee.date between date '2009-05-24' and date
'2009-05-24'
group by date
minus
select sum(money) as money, date
from temp
where date between date '2009-05-24' and date '2009-05-24'
group by date)
order by date大牛出下手,有其他解决方法没有啊
数据量在20w条左右
解决方案 »
- Oracle不能通过localhost或者127.0.0.1访问数据库
- 用存储过程来实现 数据迁移 的问题
- linux下安装oracle,被占用16G空间!!!晕!
- 好急人,我的ORACLE存储过程要计算8个小时,共计5万条记录,帮我看看,慢在哪里?
- (数据库高手进来看)oracle过程函数问题
- 想用execute immediate执行一条update的SQL语句,但不成功,请各位帮看看
- 关于toad的问题
- 在P4,XP上能装ORACLE9吗?
- 求数据库的大神看看 菜鸟在这跪求了!!
- 如何查询几天前删除过表里数据使用的是哪个账号
- 如何限制sqlserver只访问oracle指定用户的指定几张表?
- PL/SQL存储过程(procedure)的请教
你这个查询能直接minus?难道异构数据库不能直接相互操作?
偶也不懂,帮你up了。
只是远端的oracle我们只有查询权限
所以只能在本地想办法
create table test1 as
select sum(money) as paymoney, date
from [email protected]
and fee.date between date '2009-05-24' and date
'2009-05-24'
group by date ;create table test2 as
select sum(money) as money, date
from temp
where date between date '2009-05-24' and date '2009-05-24'
group by date ;然后比较test1和test2……另:有点不明白的地方,fee.date是什么?
可以使用视图吧,估计是因为20w 数据的minus太慢了,跟远程关系不大吧
试试a.date=b.date(+) and b.date is null
把minus用not exist代替试试