Help Required With SQL Subquery Across DB Link - Takes Long Time

Hi,
Apologies if this is not the correct forum but I am implementing this through HTMLDB.
I am trying to run a SQL query over a DB link with a sub query on tables in my HTMLDB workspace.
The SQL query over the database link takes 1.23 seconds to run on it's own:
SELECT D.EMAIL_ADDRESS,
D.COL2,
D.COL3,
D.COL4,
D.COL5,
D.COL6,
T.COL1
FROM SCHEMA.TABLE1@DATABASELINK D,
SCHEMA.TABLE2@DATABASELINK T
WHERE D.TABLE_JOIN = T.TABLE_JOIN
AND T.COL1 = '1111111'
AND UPPER(D.COL2) IN ('XXXXXX','YYYYYY')
The SQL query based on HTMLDB workspace tables takes 0.01 seconds to run on it's own:
SELECT UPPER(A.EMAIL_ADDRESS)
FROM HTMLDBTABLE1 M, HTMLDBTABLE2 A
WHERE M.TABLE_JOIN = A.TABLE_JOIN
AND M.ID = 222
However when I try and run these together the results take 280 seconds to complete:
SELECT D.EMAIL_ADDRESS,
D.COL2,
D.COL3,
D.COL4,
D.COL5,
D.COL6,
T.COL1
FROM SCHEMA.TABLE1@DATABASELINK D,
SCHEMA.TABLE2@DATABASELINK T
WHERE D.TABLE_JOIN = T.TABLE_JOIN
AND T.COL1 = '1111111'
AND UPPER(D.COL2) IN ('XXXXXX','YYYYYY')
AND NOT EXISTS
(SELECT UPPER(A.EMAIL_ADDRESS)
FROM HTMLDBTABLE1 M, HTMLDBTABLE2 A
WHERE M.TABLE_JOIN = A.TABLE_JOIN
AND UPPER(A.EMAIL_ADDRESS) = UPPER(D.EMAIL_ADDRESS)
AND M.ID = 222)
Does anyone have any idea why this query is taking so long?
Please let me know if you require additional information.
Many thanks,
Richard.

I've updated my profile to show my email address, so go ahead and email me the strace output (compressed please). Maximum attachment size for emails to Oracle is 10MB (encoded), so split the strace output in 5MB chunks if necessary.
poll() is not normally used by the Oracle network layer for client-server connections. So this may be related to an OS network service, such as DNS or NIS. The strace should make this clear (to me anyway).
Edited by: herb on Aug 14, 2009 10:25 AM

Similar Messages

  • Help required in SQL Tuning

    Hi
    SQL : 1
    Following Hierarchical SQL giving output with 2 seconds with 1169 records.
    SELECT LPAD ('.', 2 * (LEVEL - 1), '.') || LEVEL bom_level,
    msia.segment1
    || '.'
    || msia.segment2
    || '.'
    || msia.segment3
    || '.'
    || msia.segment4 parent_item_code,
    msia.description parent_description, msia.primary_unit_of_measure,
    LPAD ('.', 2 * (LEVEL - 1), '.')
    || msic.segment1
    || '.'
    || msic.segment2
    || '.'
    || msic.segment3
    || '.'
    || msic.segment4 component_item_code,
    msic.description component_description, bic.operation_seq_num,
    bic.component_quantity
    FROM bom_bill_of_materials bom,
    bom_inventory_components bic,
    mtl_system_items msia,
    mtl_system_items msic
    WHERE bic.bill_sequence_id = bom.bill_sequence_id
    AND msia.inventory_item_id = bom.assembly_item_id
    AND msia.organization_id = bom.organization_id
    AND msic.inventory_item_id = bic.component_item_id
    AND msic.organization_id = bom.organization_id
    START WITH bom.assembly_item_id = 1407543
    AND bom.organization_id = 56
    CONNECT BY bom.assembly_item_id = PRIOR bic.component_item_id
    AND bom.organization_id = 56;
    SQL : 2
    Following SQL giving output = 1407543
    SELECT e.equipment_item_id FROM websupp.epa_transaction_header e WHERE equipment_id = 34
    Now, when I am replacing START WITH clause of SQL:1 with SQL:2 means to replace 1407543 with SQL:2, it is taking so long time .
    Can you guide me in tuning SQL :1
    Thanks in advance
    Sanjay

    try something
    with t as
    SELECT e.equipment_item_id val FROM websupp.epa_transaction_header e WHERE equipment_id = 34
    SELECT LPAD ('.', 2 * (LEVEL - 1), '.') || LEVEL bom_level,
    msia.segment1
    || '.'
    || msia.segment2
    || '.'
    || msia.segment3
    || '.'
    || msia.segment4 parent_item_code,
    msia.description parent_description, msia.primary_unit_of_measure,
    LPAD ('.', 2 * (LEVEL - 1), '.')
    || msic.segment1
    || '.'
    || msic.segment2
    || '.'
    || msic.segment3
    || '.'
    || msic.segment4 component_item_code,
    msic.description component_description, bic.operation_seq_num,
    bic.component_quantity
    FROM bom_bill_of_materials bom,
    bom_inventory_components bic,
    mtl_system_items msia,
    mtl_system_items msic,
    t t
    WHERE bic.bill_sequence_id = bom.bill_sequence_id
    AND msia.inventory_item_id = bom.assembly_item_id
    AND msia.organization_id = bom.organization_id
    AND msic.inventory_item_id = bic.component_item_id
    AND msic.organization_id = bom.organization_id
    START WITH bom.assembly_item_id = t.val --1407543
    AND bom.organization_id = 56
    CONNECT BY bom.assembly_item_id = PRIOR bic.component_item_id
    AND bom.organization_id = 56;

  • Help required with Photoshop Elements 4.0 this has been installed on my new Toshiba laptop with windows 8.1 for some 18 months and operating well. Now it will not open, message pops up saying "attempt to access invalid address" then "application not respo

    Help required with Photoshop Elements 4.0 this has been installed on my new Toshiba laptop with windows 8.1 for some 18 months and operating well. Now it will not open, message pops up saying “attempt to access invalid address” then “application not responding” Suggestions how to access would be much appreciated. Tks. Stuart

    What is the size of your hard disk?  PSE 4 is a very old program and I suspect it is not able to access the entire hard disk on your machine.  Just a thought here.

  • Help require with installing Adobe Acrobat onto my Macbook Pro Retina.

    Help require with installing Adobe Acrobat onto my Macbook Pro Retina.
    I have successfully installed all of my creative cloud apps with the exception being acrobat.
    I cannot print from Indesign to PDF.
    I have unistalled, reinstalled and still no Adobe Acrobat.
    I now have to go back to Windows 8 and create the PDF's there.
    Any one know how to get around this issue?
    Thanks in advance
    Kelvin

    OSX has effectively killed the ability to print to pdf, (print to pdf eliminates most of the "Rich features" of current pdf).
    Export from InDesign, always, excpet for the 1% of the time where you know why print to pdf would produce a better result.

  • Help required with (soundcard) connection / settings, thanks in advan

    Help required with connection / settings between a Creative Sound Blaster Audigy Platinum EX (soundcard) and a Creative DTT3500 Digital (5. speakers).
    The problem
    No sound from any of the speakers. (Exception can plug in headphones at front)
    Background
    My computer has been recently upgraded at my local computer shop and all programs re-installed (including driver update from Creative's website). However after reconnecting speakers and restoring the original settings I?m getting no sound from any of the speakers. I?ve followed all the available advice/instructions I can find on this website and manuals to no avail.
    Set-up
    Physical
    (Digital DIN) Speakers/decoder amplifier (DTT3500) connected to the (digital out) soundcard (Audigy Platinum EX) using minijack to DIN cable. (As per instruction manual)
    Software
    Creative Audio Consul ? setting as per instructions, however have tried variations in vain. (Note: above tabs there is a select device box with SB Audigy [A0000] in it ? only option. Just wondering what [A0000] means?)
    Your advice please. A simple step by step guide would be appreciated, many thanks in advance, Jon

    "My computer has been recently upgraded at my local computer shop and all programs re-installed (including driver update from Creative's website). "
    Do you have the original installation disk?
    If so, try installing THOSE drivers, ESPECIALLY if it worked before. Be sure to uninstall what is there now, first.
    Its natural for most people to want the 'latest' drivers for their hardware. However:
    After experiencing some difficulties with some CL 'updates' for certain products, I now avoid them UNLESS I am having a PROBLEM with the existing drivers.

  • Can someone help me with an iCloud problem when I take a picture with my iPhone 4s it some of the times go to my ipad2 but mostly it doesn't can anyone help me out

    Can someone help me with an iCloud problem when I take a picture with my iPhone 4s it some of the times go to my ipad2 but mostly it doesn't can anyone help me out

    I'm assuming you have Photo Stream set up of both devices.  However, it seems many users are experiencing the same as you - my take is that streaming photos is not foolproof yet.

  • Can Apple make an app or an update that makes you insert your password to turn your phone off? This can help deal with theft of iPhones because people take or find a iPhone, the first thing they do is turn the phone off.

    Can Apple make an app or an update that makes you insert your password to turn your phone off? This can help deal with theft of iPhones because people take or find a iPhone, the first thing they do is turn the phone off.

    They probably can do such s thing if they choose to do so.
    Let them know that you would like this:
    http://www.apple.com/feedback
    Not sure this is a very useful thing.  It would run down the battery.  All a thief has to do is remove them SIM and restore the iphone to stop it from being tracked.

  • How to tune this SQL (takes long time to come up with results)

    Dear all,
    I have sum SQL which takes long time ... can any one help me to tune this.... thank You
    SELECT SUM (n_amount)
    FROM (SELECT DECODE (v_payment_type,
    'D', n_amount,
    'C', -n_amount
    ) n_amount, v_vou_no
    FROM vouch_det a, temp_global_temp b
    WHERE a.v_vou_no = TO_CHAR (b.n_column2)
    AND b.n_column1 = :b5
    AND b.v_column1 IN (:b4, :b3)
    AND v_desc IN (SELECT v_trans_source_code
    FROM benefit_trans_source
    WHERE v_income_tax_app = :b6)
    AND v_lob_code = DECODE (:b1, :b2, v_lob_code, :b1)
    UNION ALL
    SELECT DECODE (v_payment_type,
    'D', n_amount,
    'C', -n_amount
    * -1 AS n_amount,
    v_vou_no
    FROM vouch_details a, temp_global_temp b
    WHERE a.v_vou_no = TO_CHAR (b.n_column2)
    AND b.n_column1 = :b5
    AND b.v_column1 IN (:b12, :b11, :b10, :b9, :b8, :b7)
    AND v_desc IN (SELECT v_trans_source_code
    FROM benefit_trans_source
    WHERE income_tax_app = :b6)
    AND v_lob_code = DECODE (:b1, :b2, v_lob_code, :b1));
    Thank You.....

    Thanks a lot,
    i did change the SQL it works fine but slows down my main query.... actually my main query is calling a function which does the sum......
    here is the query.....?
    select A.* from (SELECT a.n_agent_no, a.v_agent_code, a.n_channel_no, v_iden_no, a.n_cust_ref_no, a.v_agent_type, a.v_company_code,
    a.v_company_branch, a.v_it_no, bfn_get_agent_name(a.n_agent_no) agentname,
    PKG_AGE__TAX.GET_TAX_AMT(:P_FROM_DATE,:P_TO_DATE,:P_LOB_CODE,A.N_AGENT_NO)  comm,
    c.v_ird_region
    FROM agent_master a, agent_lob b, agency_region c
    WHERE a.n_agent_no = b.n_agent_no
    AND a.v_agency_region = c.v_agency_region
    AND :p_lob_code = DECODE(:p_lob_code,'ALL', 'ALL',b.v_line_of_business)
    AND :p_channel_no = DECODE(:p_channel_no,1000, 1000,a.n_channel_no)
    AND :p_agency_group = DECODE(:p_agency_group,'ALL', 'ALL',c.v_ird_region)
    group by a.n_agent_no, a.v_agent_code, a.n_channel_no, v_iden_no, a.n_cust_ref_no, a.v_agent_type, a.v_company_code, a.v_company_branch, a.v_it_no, bfn_get_agent_name(a.n_agent_no) ,
    BPG_AGENCY_GEN_ACL_TAX.BFN_GET_TAX_AMOUNT(:P_FROM_DATE,:P_TO_DATE,:P_LOB_CODE,A.N_AGENT_NO),
    c.v_ird_region
    ORDER BY c.v_ird_region, a.v_agent_code DESC)
    A
    WHERE (COMM < :P_VAL_IND OR      COMM >=:P_VAL_IND1);
    Any idea to make this faster....
    Thank You...

  • Analyze a Query which takes longer time in Production server with ST03 only

    Hi,
    I want to Analyze a Query which takes longer time in Production server with ST03 t-code only.
    Please provide me with detail steps as to perform the same with ST03
    ST03 - Expert mode- then I need to know the steps after this. I have checked many threads. So please don't send me the links.
    Write steps in detail please.
    <REMOVED BY MODERATOR>
    Regards,
    Sameer
    Edited by: Alvaro Tejada Galindo on Jun 12, 2008 12:14 PM

    Then please close the thread.
    Greetings,
    Blag.

  • I have the current Mac Pro the entry level with the default specification and i feel some slow performance when applying after effects on my videos using final cut pro and also rendering a video takes long time ? what upgrades do you guys suggest?

    i have the current Mac Pro the entry level with the default configuration   and i feel lack of  performance when applying after effects on my videos using final cut pro and also rendering a video takes long time ? what upgrades do you guys suggest i could do on my Mac Pro ?

    256GB SSD  it shipped with will run low and one of the things to watch.
    Default memory is 12GB  also something to think about.
    D500 and FCP-X 10.1+
    http://macperformanceguide.com/index_topics.html#MacPro2013Performance
    Five models of 2013 Mac Pro running Resolve, FCPX, After Effects, Photoshop, and Aperture

  • Why outlook2011 mac version* takes long time to boot with OSX

    why outlook2011 mac version* takes long time to boot with OSX

    Okay, so after doing all of the above, the computer still takes between 40 seconds and 1 minute or so to boot up, and the VersionCue messages still appear. However I discovered that the "kdcmond cannot retrieve..." messages disappeared after I disabled my ethernet connections. So at least I know that that had nothing to do with the extended boot-up time.
    I have heard that the more RAM you have, the longer it takes to boot due to the RAM count. Since I have 10 GB, maybe this is why?
    I've included the most recent Console messages below:
    22/4/08 9:56:16 AM com.apple.launchctl.System[2] launchctl: Please convert the following to launchd: /etc/mach_init.d/dashboardadvisoryd.plist
    22/4/08 9:56:16 AM com.apple.launchd[1] (com.adobe.versioncueCS3) Unknown key: ServiceDescription
    22/4/08 9:56:16 AM com.apple.launchd[1] (org.cups.cups-lpd) Unknown key: SHAuthorizationRight
    22/4/08 9:56:16 AM com.apple.launchd[1] (org.cups.cupsd) Unknown key: SHAuthorizationRight
    22/4/08 9:56:16 AM com.apple.launchd[1] (org.ntp.ntpd) Unknown key: SHAuthorizationRight
    22/4/08 9:56:39 AM com.apple.SystemStarter[28] Starting Aladdin USB daemon
    22/4/08 9:56:39 AM org.ntp.ntpd[25] Error : nodename nor servname provided, or not known
    22/4/08 9:56:39 AM com.apple.launchd[1] (com.apple.UserEventAgent-LoginWindow[74]) Exited: Terminated
    22/4/08 9:56:39 AM com.apple.launchctl.Aqua[90] launchctl: Please convert the following to launchd: /etc/machinit_peruser.d/com.adobe.versioncueCS3.monitor.plist
    22/4/08 9:56:42 AM com.apple.launchd[82] (0x1011e0.VersionCueCS3monitor) Failed to check-in!

  • MIRO take long time when enter invoice for PO with GR-based invoice

    Hi,
    In my client system, system take long time for extracting PO data while booking invoice via. MIRO for the purchase order which have GR-based IV is marked. However system take few second for extracting PO data when enter invoice via. MIRO for the PO which don't have GR-based IV. Please note following point while providing the solution:
    - this problem is exist only for the purchase order related to one company code. However system working perfectly for other company code in the same client. Hence we assuming that some company code level cofiguration is missing.
    - the problem is exist for po with account assignment K.
    - we have one to one mapping for purchase organization to company code to plant.
    Appreciate for you quick respond. Thanks in advance.
    Regards,
    sp sahu

    Hi,
    Please check with FI guy for GL A/c and Cost centers which you are using to create the PO with item category K.
    Still problem permits check with your ABAP person.
    Regards,
    Mohd Ali.

  • Help required with Gnome 3 Input Sources

    I used CapsLock before gnome 3.6 upgrade all working fine, however new Input Sources broke my system a little bit
    I fixed my CapsLock by dconf-editor org\gnome\desktop\input-sources\xkb-options ['grp:caps_toggle', 'grp_switch', 'grp_led:caps'], but I can't get work
    - language switch indicator not working
    - show-flags does nothing anymore
    Any help fit is required because of usability issues

    Also, with Gnome 3.6 it's no longer possible to switch layouts with the Caps key. That setting is not available even in gnome-tweak-tool.
    I figured out how to do make the settings a lot more flexible, and fix all the layout bugs introduced by 3.6. This is done by configuring everything through setxkbmap and not letting gnome interfere with the settings.
    Remove all input sources, and the typing shortcuts from gnome keyboard settings window.
    Open dconf-editor and remove everything from "org\gnome\desktop\input-sources\xkb-options". I was not able to set it to nothing, but setting it to ['grp_led:caps'] worked. These 2 steps were needed not to interfere with the config described below.
    Install kbdd-git from aur, if you want separate layout for each window.
    Create a script with preferred setxkbmap settings. Here is mine, setting Caps to switch languages, and swapping alt and win keys on MacBook.
    #!/bin/sh
    setxkbmap -layout us,ru
    setxkbmap -option 'grp:caps_toggle'
    setxkbmap -option 'altwin:swap_lalt_lwin'
    # kbdd is needed to keep separate layout for each window.
    `which kbdd` && kbdd
    Launch gnome-session-properties and add this script to the list.
    Last edited by ikatson (2012-11-02 21:51:13)

  • Help required with URL class

    Hi,
    I am writing a small webcrawler in java.I am searching the webpage for a particular hyperlink(based ont he text).Can i get the text associated with the hyperlink using the URL class?.I am able to get the url the hyperlink is pointing to , but not the text displayed.
    For example..
    If there is a hyperlink on the word "Login" in a page. I want to fetch the text "Login".
    Any immediate help would be highly appreciated.
    Thanks!!

    do not need all the "hyperlinks" in the page but only the hyperlinks which
    match my text.. For ex:only the hyperlink with the word "Login" in my example..
    How do i do that?It took you a grand total of 7 minutes from the time I posted the suggestion until you posted your reply. You obviously didn't take any time to think about a possible solution on your own.
    If you can parse the link out of an HTML page do you think there might be a way to parse out the text related to that link? I'll let you read the API and try to figure out a solution. You learn by trying and making mistakes.
    You don't learn anything by asking people

  • Help required with Select statment..... ASAP pls

    HI All,
    Let me desc my table first .
    01                             NOT NULL VARCHAR2(5)                                                                                                                                                                                  
    02                             NOT NULL VARCHAR2(5)                                                                                                                                                                                  
    03                             NOT NULL VARCHAR2(5)                                                                                                                                                                                  
    04                             NOT NULL VARCHAR2(5)
    31                                                    This is how table has been created(Note:not by me)
    select name from  od_shift  where year=2011 and month='Feb' and  "02"='W"{code}-->no doubt this is working fine
    My problem is ...here rather putting the number directly ("01","02","03"....."31") 
    I need to take it from the first two digits of date('01-feb-2011') 
    like {code}
      select name from  od_shift  where year=2011 and month='Feb' and  to_char(to_date('01-feb-2011','dd-mon-yyyy'),'dd')='W" but this is not working
    kindly help me with this .
    Edited by: Basva on Mar 8, 2011 4:53 AM

    Pleiadian wrote:
    You could do a case statement. It's not elegant, but it works
    Edit: smon's solution is better if pl/sql is an optionI disagree, it's quite elegant given the cirumstances of that sick table. And it definitely beats a dynamic SQL solution.
    @Basva - when will you realize that your table is no good, and needs to be normalized into a more traditional relational table?
    Regards
    Peter

Maybe you are looking for

  • Send Vendor Balance confirmations report output (F.18) to External email ID

    Dear Friends. I have following requirement Our Client requirement is to send Vendor Balance confirmations report output (Tcode F.18) to external email ID of vendor. So please guide accordingly. I have done BASIS Settings for SMTP (Tcode SCOT, RZ10) a

  • How To Update A Record?  What is Wrong With My Code?

    I tried to update a record and got the java.lang.ArrayIndexOutOfBoundsException: 0 Here is my code:    public void updateLastPostMemberName(int threadID, // primary key                                         String lastPostMemberName)               

  • Aperture Kernel Panics & Fusion Disk Corruptions

    We have a  new iMac with the Fusion drive bought not to long ago. It has 16gb memory. Since it's back to school, we are busier than this past summer We are editing about 200 - 400 images a day. While in Aperture we have had kernel panics and a major

  • System Preferences and Safari issues

    Hi I have a very concerning issue with system preferences and a smaller issue with Safari (7.0).  When I open system preferences and navigate to the "internet accounts" page and try to remove an account or click the "Advanced" button, nothing happens

  • Icon preview in the Finder won't work anymore.

    After doing a 10.5.6 "Archive and Install", all the iWork '09 icon previews disappeared. The files were saved with the "Include preview in document" selected. No luck with "Show View Options". Any ideas?