Solved

Query slow over Dblink.

Posted on 2013-11-19
2
469 Views
Last Modified: 2013-11-20
Hi all,

When I am trying to execute the below query, it is very slow(1 to 2 mins), but that not happens everytime, like once in 5 or 6 times.

SELECT SUM(NVL(TOT_NO_PKGS,0))
        FROM MQ_DPC_PKGS MDP,
             MQ_DPC_BOES MDB
       WHERE MDP.DOC_NO    = MDB.DOC_NO
         AND MDP.BILL_NO   = MDB.BILL_NO
         AND MDB.BILL_NO = '303-00006116-13'
         AND REC_TYPE      = 'I'
   AND NVL (MDP.DEL_IND, 'N') = 'N'

table MQ_DPC_PKGS is from remote DB. Help me to find out reason / solution.
query-cost.jpg
0
Comment
Question by:sakthikumar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 250 total points
ID: 39659245
Check the query/plan from the remote database.

Also try monitoring network usage when it is slow.
0
 
LVL 13

Accepted Solution

by:
magarity earned 250 total points
ID: 39661339
Your query specifies one particular BILL_NO on the local table but not on the remote table. The optimizer may be translating that to a table scan on the remote.  I suggest either:
1) switch the BILL_NO to the remote table: MDP.BILL_NO = '303-00006116-13' (instead of MDB.BILL_NO =)
OR
2) move the query processing to the remote server with the 'driving_site' hint, see the Oracle documentation here: http://docs.oracle.com/cd/B10501_01/server.920/a96533/hintsref.htm#5699
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question