RE: DB Links

  • From: Kevin Lange <klange@xxxxxxxxxx>
  • To: "Oracle-L (E-mail)" <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 23 Sep 2004 11:57:52 -0500

With the DRIVING_SITE syntax pointing to a particular table, how can you
affect more than one table at that site ?   Do you list the various tables
in the DRIVING_SITE hint ??  Or can you only affect the output from a
particular table?? 

-----Original Message-----
From: Yechiel Adar [mailto:adar76@xxxxxxxxxxxx]
Sent: Thursday, September 23, 2004 8:27 AM
To: 'adar76@xxxxxxxxxxxx'; Oracle-L (E-mail)
Subject: Re: DB Links


I found this by searching metalink for driving_site:
This also answer Kevin question about joins over dblink.

From: Melanie Kiburtz 10-Aug-04 18:19
Subject: Re : performance of joins over a dblink


The whole issue with remote joins has to do with the fact that oracle will
NOT utilize remote indices if the join is executed locally. So, in the case
where you have a local small table joined with a remote large table, the
entire remote table (referenced columns) is sent to the local db for joining
activity. Local indices can be used for the local tables. So this is why the
'remote reverse query' method is used. By setting up the appropriate views,
synonyms and dblinks to force the query to actually be executed on the
remote db performance can be dramatically improved. The forcing of the query
to execute on the remote db, the small table is then sent to the remote db
for the join function. Since the sql is actually executed on the remote db,
the remote db is the 'local db' for the query execution and therefore can
utilize the indices for table on that db. The small table would NOT utilize
indices in this case.

Does it work? Yes and extremely well as long as there is a significant
difference in the sizes of the tables and indices are actually used. Keep in
mind that either the optimizer or by virtue of the sql code itself, the
'desired' index may not be used unless hints are employed. You will need to
carefully examine the explain plans.

Another option with 9i is the following pasted info which eliminates the
need to mess with views, synonyms etc yourself. For 3rd party software you
could create a synonyms or view locally that induces the hint or you could
use OUTLN to force the plan:
===========================
DRIVING_SITE
The DRIVING_SITE hint forces query execution to be done at a different site
than
that selected by Oracle. This hint can be used with either rule-based or
cost-based
optimization.
driving_site_hint::=
where table is the name or alias for the table at which site the execution
should
take place.
For example:
SELECT /*+DRIVING_SITE(dept)*/ *
FROM emp, dept@rsite
WHERE emp.deptno = dept.deptno;
If this query is executed without the hint, then rows from dept are sent to
the local
site, and the join is executed there. With the hint, the rows from emp are
sent to the
remote site, and the query is executed there, returning the result to the
local site.
This hint is useful if you are using distributed query optimization.
/*+ DRIVING_SITE ( table ) */
==================

the above was pasted from the 9i Database Performance Tuning Guide and
Reference manual




Melanie Kiburtz
DBA
Oregon, USA



Yechiel Adar
Mehish

--
//www.freelists.org/webpage/oracle-l
--
//www.freelists.org/webpage/oracle-l

Other related posts: