Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Mailing Lists -> Oracle-L -> RE: DB Links

RE: DB Links

From: Mercadante, Thomas F <>
Date: Thu, 23 Sep 2004 10:36:16 -0400
Message-ID: <C9995D8C5E0DDA4A8FF9D68EE666CE07A7F8A9@exchsen0a1ma>


The results of this hint are pretty amazing. I have a query in production that runs in about 5-10 seconds. When I apply this hint, it runs in less than 1 second. This is on

Got to keep on testing it! Thanks again!

Tom Mercadante
Oracle Certified Professional

-----Original Message-----
From: Yechiel Adar [] Sent: Thursday, September 23, 2004 9:27 AM To: ''; 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_at_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
Oregon, USA

Yechiel Adar

Received on Thu Sep 23 2004 - 09:31:56 CDT

Original text of this message