我试图让我的查询尽可能快地运行,但是我正努力让它在5秒以内。oracle查询的优化
我想这是因为我引用两个相连的数据库
这里是我的查询
select column2, column3, column4
from [email protected]
where column1 in (
select distinct column2
from [email protected]
where column3 > 0
)
order by column1
有没有办法来优化这个查询了吗?
我一直在使用join
尝试,但它似乎使查询运行较长
在此先感谢
编辑
进一步调查DRIVING_SITE
使它像这样运行
select /*+ DRIVING_SITE(table1) */ t1.column2, t1.column3, t1.column4
from [email protected] t1, [email protected] t2
WHERE t2.column3 > 0
但是,只要我将distinct column2
在它使它运行非常缓慢
一个综合指数。 http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements006.htm#SQLRF50704 –
你不需要'IN'(SELECT ...)里的'distinct' –
什么你有2张桌子上的索引吗? –