Path: newssvr20.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!pd7cy2so!pd7cy1no!shaw.ca!sjc70.webusenet.com!news.webusenet.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail
From: Daniel Morgan <damorgan@x.washington.edu>
Newsgroups: comp.databases.oracle.server
Subject: Re: Can anybody explain this strange thing?
Date: Thu, 01 Jan 2004 21:26:20 -0800
Organization: ATS
Message-ID: <1073021093.278943@yasure>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
X-Accept-Language: en-us, en
MIME-Version: 1.0
References: <bd1Jb.24388$I07.64079@attbi_s53> <3FF4C746.6040001@skynet.be>
In-Reply-To: <3FF4C746.6040001@skynet.be>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Cache-Post-Path: yasure!unknown@oracle.advtechserv.com
X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/)
X-Complaints-To: abuse@supernews.com
Lines: 56
Xref: newssvr20.news.prodigy.com comp.databases.oracle.server:251129

Gerard H. Pille wrote:
> vic wrote:
> 
>> I have 2 servers, server a is HP (DSS) and server b is Sun.  Now one 
>> of the
>> applications among these 2 servers is to query server b from server a.
>> server a has a user, which has a dblink to connect to server b. The 
>> strange
>> thing is:
>> If I query server a from server b using sqlplus as:
>> sql> conn user/password@b from server a and run query, e.g.
>> sql> select ... from table1 , table2 where....  The elapsed time is 10
>> seconds but if I use a user in server b and use its dblink (svra) to run:
>> sql > select ... from table1@svra , table2@svra where.... the elased 
>> time is
>> 4 minutes.
>> The listener.ora for server a has an entry as sdu=32768 and 
>> tnsnames.ora in
>> server b (hp) has also sdu=32768 as its entry.  I set tdu for both the 
>> same
>> as sdu.  It is still the same.  Theoritically they should have the same
>> response time.  Why using sqlplus is faster than using dblink?  The 
>> dblink
>> user is also the same user I connect from server a with sqlplus and 
>> the same
>> connect string as the using clause in dblink.  I couldn't figure out.  I
>> think it is strange.  Does anyone have the same strange experience as 
>> mine?
>> Has anyone ever tackled this issue and willing to share it with me and
>> others?
>>
>> Thanks in advance.
>>
>>
> 
> It's not strange: using the db-link, Oracle may need to fetch both 
> tables completely, and will then join (where-clause) on server b.  In 
> the first case, the action happens on server a, only the results are 
> transferred.
> 

Take a look at the hint "DRIVING_SITE in the form:

SELECT /*+DRIVING_SITE(dept)*/ e.empno, e.empname
FROM emp e, dept@RSITE d
WHERE e.deptno = d.deptno;

It may solve the problem.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan@x.washington.edu
(replace 'x' with a 'u' to reply)

