Issue with query involving remote tables

Hi I have a query inside a procedure that has 4 union all statements ,2 of which are based on tables at a remote database.
The query is something like
Select col1, col2, col3…..col n from Table_a, table_b, table c where join condition and certain hard-coded conditions based on run time parameters
Union all
Select col1, col2, col3…..col n from Table_a, table_b , table c where some join condition and certain hard-coded conditions based on run time parameters
Union all
Select col1, col2, col3…..col n from Table_a@remote_db, table_b@remote_db, table c@remote_db where join condition and certain hard-coded conditions based on run time parameters
Union all
Select col1, col2, col3…..col n from Table_a @remote_db, table_b @remote_db, table c@ remote_db where some join condition and certain hard-coded conditions based on run time parameters
The join conditions on the tables are quite good and when executed individually bring data in good time.The queries on the remote database also run fine when I execute them in the remote database.
However when I run this query, it doesn’t get data at all and after hours of running I have to cancel or kill it.I don’t get anything in the long-ops and in the wait class it just shows “SQL*Net message from dblink” or “SQL*Net more data to dblink”.
I thought that there could be some latency issues AND the data retreival over the dblink could be slow, so I tried the /*+driving_site(rmote table alias)*/ hint , after which it comes up in the long ops as its reading from Table a/ table b from my current database but the wait time is something like millions of seconds and it runs forever.
The issue is Table A and Table B both in the remote and the current database are huge tables with at least 40-50 million records in them.
Can anyone suggest an easy way out in this scenario, other than the hard way of re-designing the entire program(which I am afraid I might have to in the end).
Thanks

@metzquar I Put the hint in the unions where I am accessing the remote tables
@blushadow .. i was thinking about that but as these remote tables are in a sort of archived database, I dont think I will be allowed to create a mview.But thats a good suggestion.
@Earth.. I tried that , but the table population itself gets very time consuming
Thanks

Similar Messages

  • Performance issues with version enable partitioned tables?

    Hi all,
    Are there any known performance issues with version enable partitioned tables?
    I’ve been doing some performance testes with a large version enable partitioned table and it seems that OCB optimiser is choosing very expensive plans during merge operations.
    Tanks in advance,
    Vitor
    Example:
         Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    UPDATE STATEMENT Optimizer Mode=CHOOSE          1          249                    
    UPDATE     SIG.SIG_QUA_IMG_LT                                   
    NESTED LOOPS SEMI          1     266     249                    
    PARTITION RANGE ALL                                   1     9
    TABLE ACCESS FULL     SIG.SIG_QUA_IMG_LT     1     259     2               1     9
    VIEW     SYS.VW_NSO_1     1     7     247                    
    NESTED LOOPS          1     739     247                    
    NESTED LOOPS          1     677     247                    
    NESTED LOOPS          1     412     246                    
    NESTED LOOPS          1     114     244                    
    INDEX RANGE SCAN     WMSYS.MODIFIED_TABLES_PK     1     62     2                    
    INDEX RANGE SCAN     SIG.QIM_PK     1     52     243                    
    TABLE ACCESS BY GLOBAL INDEX ROWID     SIG.SIG_QUA_IMG_LT     1     298     2               ROWID     ROW L
    INDEX RANGE SCAN     SIG.SIG_QUA_IMG_PKI$     1          1                    
    INDEX RANGE SCAN     WMSYS.WM$NEXTVER_TABLE_NV_INDX     1     265     1                    
    INDEX UNIQUE SCAN     WMSYS.MODIFIED_TABLES_PK     1     62                         
    /* Formatted on 2004/04/19 18:57 (Formatter Plus v4.8.0) */                                        
    UPDATE /*+ USE_NL(Z1) ROWID(Z1) */sig.sig_qua_img_lt z1                                        
    SET z1.nextver =                                        
    SYS.ltutil.subsversion                                        
    (z1.nextver,                                        
    SYS.ltutil.getcontainedverinrange (z1.nextver,                                        
    'SIG.SIG_QUA_IMG',                                        
    'NpCyPCX3dkOAHSuBMjGioQ==',                                        
    4574,                                        
    4575                                        
    4574                                        
    WHERE z1.ROWID IN (
    (SELECT /*+ ORDERED USE_NL(T1) USE_NL(T2) USE_NL(J2) USE_NL(J3)
    INDEX(T1 QIM_PK) INDEX(T2 SIG_QUA_IMG_PKI$)
    INDEX(J2 WM$NEXTVER_TABLE_NV_INDX) INDEX(J3 MODIFIED_TABLES_PK) */
    t2.ROWID
    FROM (SELECT /*+ INDEX(WM$MODIFIED_TABLES MODIFIED_TABLES_PK) */
    UNIQUE VERSION
    FROM wmsys.wm$modified_tables
    WHERE table_name = 'SIG.SIG_QUA_IMG'
    AND workspace = 'NpCyPCX3dkOAHSuBMjGioQ=='
    AND VERSION > 4574
    AND VERSION <= 4575) j1,
    sig.sig_qua_img_lt t1,
    sig.sig_qua_img_lt t2,
    wmsys.wm$nextver_table j2,
    (SELECT /*+ INDEX(WM$MODIFIED_TABLES MODIFIED_TABLES_PK) */
    UNIQUE VERSION
    FROM wmsys.wm$modified_tables
    WHERE table_name = 'SIG.SIG_QUA_IMG'
    AND workspace = 'NpCyPCX3dkOAHSuBMjGioQ=='
    AND VERSION > 4574
    AND VERSION <= 4575) j3
    WHERE t1.VERSION = j1.VERSION
    AND t1.ima_id = t2.ima_id
    AND t1.qim_inf_esq_x_tile = t2.qim_inf_esq_x_tile
    AND t1.qim_inf_esq_y_tile = t2.qim_inf_esq_y_tile
    AND t2.nextver != '-1'
    AND t2.nextver = j2.next_vers
    AND j2.VERSION = j3.VERSION))

    Hello Vitor,
    There are currently no known issues with version enabled tables that are partitioned. The merge operation may need to access all of the partitions of a table depending on the data that needs to be moved/copied from the child to the parent. This is the reason for the 'Partition Range All' step in the plan that you provided. The majority of the remaining steps are due to the hints that have been added, since this plan has provided the best performance for us in the past for this particular statement. If this is not the case for you, and you feel that another plan would yield better performance, then please let me know and I will take a look at it.
    One suggestion would be to make sure that the table was been recently analyzed so that the optimizer has the most current data about the table.
    Performance issues are very hard to fix without a reproducible test case, so it may be advisable to file a TAR if you continue to have significant performance issues with the mergeWorkspace operation.
    Thank You,
    Ben

  • Performance issue with Query

    11g
    Hi there experts,
      I have an issue with performance with a simple SQL which I thought cannot be tuned but just wanted to check with the experts here. We are running a query to get a persons ID based on his logged in email address from a Parties table which is huge (Millions of records). The query takes about 30 seconds to return a value. Was wondering is there a way to optimize this
    The query is
    {code}
    select par.party_id
    from parties party, users users
    where
    lower(party.email_address) = lower(:USER_EMAIL)
    and party.system_reference = to_char(users.person_id)
    and users.active_flag ='Yes';
    {code}
    The emails are stored in upper and lower, hence the lower functions
    IS creating a function based index the only way?
    Thanks,
    Ryan

    Hi Everyone.
    Thanks and apologies, first post on tuning as such. Here is the explain plan generated through SQL DEVELOPER. IT showed the output in XML
    By the way, looks like the {code} tag does not work?
    {code}
      SELECT STATEMENT
      84903
         HASH JOIN
      84903
         Access Predicates
         PARTY.ORIG_SYSTEM_REFERENCE=TO_CHAR(PERSON_ID)
         TABLE ACCESS
         PER_USERS
      STORAGE FULL
      1059
         Access Predicates
         AND
         ACTIVE_FLAG='Y'
         OR
         OR
         BUSINESS_GROUP_ID=0
         BUSINESS_GROUP_ID=1
         BUSINESS_GROUP_ID=DECODE(SYS_CONTEXT('FND_VPD_CTX','FND_ENTERPRISE_ID'),NULL,BUSINESS_GROUP_ID,TO_NUMBER(SYS_CONTEXT('FND_VPD_CTX','FND_ENTERPRISE_ID')))
         Filter Predicates
         AND
         ACTIVE_FLAG='Y'
         OR
         OR
         BUSINESS_GROUP_ID=0
         BUSINESS_GROUP_ID=1
         BUSINESS_GROUP_ID=DECODE(SYS_CONTEXT('FND_VPD_CTX','FND_ENTERPRISE_ID'),NULL,BUSINESS_GROUP_ID,TO_NUMBER(SYS_CONTEXT('FND_VPD_CTX','FND_ENTERPRISE_ID')))
         TABLE ACCESS
         HZ_PARTIES
      STORAGE FULL
      83843
         Access Predicates
         LOWER(PARTY.EMAIL_ADDRESS)='[email protected]'
         Filter Predicates
         LOWER(PARTY.EMAIL_ADDRESS)='[email protected]'
    {code}
    Purvesh, around 50% are 'Yes'
    Thanks!

  • Performance issues with query input variable selection in ODS

    Hi everyone
    We've upgraded from BW 3.0B to NW04s BI using SP12.
    There is a problem encountered with input variable selection. This happens regardless of using BEx (new or old 3.x) or using RSRT. When using the F4 search help (or "Select from list" in BEx context) to list possible values, this takes forever for large ODS (containing millions of records).
    Using ST01 and SM50 to trace the code in the same query, we see a difference here:
    <u>NW04s BI SQL command</u>
    SELECT                                                                               
    "P0000"."COMP_CODE" AS "0000000032" ,"T0000"."TXTMD" AS "0000000032_TXTMD"                             
    FROM                                                                               
    ( "/BI0/PCOMP_CODE" "P0000" ) LEFT OUTER JOIN "/BI0/TCOMP_CODE" "T0000" ON  "P0000"."COMP_CODE" = "T0000
      "."COMP_CODE"                                                                               
    WHERE                                                                               
    "P0000"."OBJVERS" = 'A' AND "P0000"."COMP_CODE" IN ( SELECT "O"."COMP_CODE" AS "KEY" FROM              
      "/BI0/APY_PP_C100" "O" )                                                                               
    ORDER BY                                                                               
    "P0000"."COMP_CODE" ASC#                                                                               
    <u>BW 3.0B SQL command:</u>
    SELECT ROWNUM < 500 ....
    In 3.0B, rownum is limited to 500 and this results in a speedy, though limited query. In the new NW04s BI, this renders the selection screen unusable as ABAP dumps for timing out will occur first due to the large data volume searched using sequential read.
    It will not be feasible to create indexes for every single query selection parameter (issues with oerformance when loading, space required etc.). Is there a reason why SAP seems have fallen back on a less effective code for this?
    I have tried to change the number of selected rows to <500 in BEx settings but one must reach a responsive screen in order to get to that setting and it is not always possible or saved for the next run.
    Anyone with similar experience or can provide help on this?

    here is a reason why the F4 help on ODS was faster in BW 3.x.
    In BW 3.x the ODS did not support the read mode "Only values in
    InfoProvider". So If I compare the different SQL statements I propose
    to change the F4 mode in the InfoProvider specific properties to
    "About master data". This is the fastest F4 mode.
    As an alternative you can define indexes on your ODS to speed up F4.
    So would need a non-unique index on InfoObject 0COMP_CODE in your ODS
    Check below for insights
    https://forums.sdn.sap.com/click.jspa?searchID=6224682&messageID=2841493
    Hope it Helps
    Chetan
    @CP..

  • Issue with Query on a virtual infoprovider

    Hello,
    I am getting the following error message while executing a query on a virtual infoprovider. We have recently gone through upgrade from BI 3.5 to BI 7.0 EHP1 (SP5) and from SEM BCS 4.0 to BCS 6.0.
    EVersion not specified or not unique                                                             UCR0                006                   
    EError reading the data of InfoProvider ZBCS_CV11                                    DBMAN             305ZBCS_CV11          
    EError while reading data; navigation is possible                                          BRAIN               289                   
    I>> Row: 11 Inc: RAISE_READ_ERROR Prog: CL_RSDRV_VPROV_BASE   RS_EXCEPTION        301CL_RSDRV_VPROV_BASE
    this query has been running fine before the upgrade. In the selection screen there are two fields - version1 and version2, if I am specifying same value in both the fields then the query runs fine and if I am providing different values then the above stated error message appears.
    I have tried different settings with properties - Read mode: H,A,X and also different combination from the properties of the virtual infoprovider - with and w/o hierarchies; with and w/o navigation attributes but it did not workout.
    the only thing which has changed on this virtual provider is that I had enabled delta caching as this was supposed to be used in a multiprovider.
    Has anyone experienced similar issue or have an idea as to what is going wrong here. Please advice.
    Regards,
    Manish

    Hi Manish,
    I have exactly the same issue with a query on a virtual infoprovider after upgrading from BI 3.5 to BI 7.0 EHP1 (SP5) and from SEM BCS 4.0 to BCS 6.0.
    Would you be so kind to tell me how you fixed this. (other queries seem to be working)
    Kind regards,
    Jamie Flaxman

  • ADF Faces - issue with Portal and af table

    I wonder if anybody could help me with a problem we are experiencing with running our ADF Faces app inside a portal (NOT Oracle Portal). We are using the af table tag with the rows attribute set as follows:
    <af:table emptyText="No items found"
    rows="10" banding="row"
    bandingInterval="1"
    binding="#{backing_ModuleSearchReg.table1}"
    id="table1"
    var="row">
    What this does is if we have more than 10 rows to display it will display
    a table header that has a label 'Previous 1-10 of nnn' Next 10. However, when you click on 'Next 10' it produces a Javascript error.
    When we run the app outside of the portal we do not get this problem.
    I believe this is related to known issues with JSF and Javascript inside a 'framed' web page. But if anybody help me with this or point me to a resource that can help it would be very much appreciated.
    Many Thanks in advance.
    Chris

    Hi,
    I remember a similar issue with inner frames that should be fixed in JDeveloper 10.1.3.3. The problem was that the ADF Faces JavaScript did not get the correct document root.
    Frank

  • Issue with input field in table control

    Hi,
    I have an issue with field acgl_item-rstgr in the table control.
    I have created a screen program with a table control.
    In the control i have added a dictionary field as acgl_item-rstgr.
    When i execute, do f4 on the input field, select a value and press enter, then it is showing me
    error as 'Entry 'val' does not exist in T053R (check entry). Its really weird to understand this. I have selected the value
    from f4 and even then it says this. Its working for all other columns, but not working only for RSTGR.
    Plz help me on this regard.
    Code is like this.
    TYPES : BEGIN OF ty_rstgr,
              rstgr TYPE RSTGR,
             END OF ty_rstgr.
    TABLES : ACGL_ITEM.
    DATA : it_rstgr TYPE TABLE OF ty_rstgr.
    DATA : wa_rstgr TYPE  ty_rstgr.
    CONTROLS : table TYPE TABLEVIEW USING SCREEN 100.
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
    LOOP AT it_rstgr INTO wa_rstgr WITH CONTROL TABLE.
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0100.
      LOOP AT it_rstgr.
      ENDLOOP.
    Thanks,

    Hi Navitha,
    Its Check Table concepts for the error u stated. Please check wht the Search help ur using...Because for this field there is no search help at value table level...Use search help that hold all master data or create a custom search field in SE11 level or in program level.
    Cheers,
    Naveen

  • Performance problem with query on bkpf table

    hi good morning all ,
    i ahave a performance problem with a below query on bkpf table .
    SELECT bukrs
               belnr
               gjahr
          FROM bkpf
          INTO TABLE ist_bkpf_temp 
         WHERE budat IN s_budat.
    is ther any possibility to improve the performanece by using index .
    plz help me ,
    thanks in advance ,
    regards ,
    srinivas

    hi,
    if u can add bukrs as input field or if u have bukrs as part of any other internal table to filter out the data u can use:
    for ex:
    SELECT bukrs
    belnr
    gjahr
    FROM bkpf
    INTO TABLE ist_bkpf_temp
    WHERE budat IN s_budat
        and    bukrs in s_bukrs.
    or
    SELECT bukrs
    belnr
    gjahr
    FROM bkpf
    INTO TABLE ist_bkpf_temp
    for all entries in itab
    WHERE budat IN s_budat
        and bukrs = itab-bukrs.
    Just see , if it is possible to do any one of the above?? It has to be verified with ur requirement.

  • Issues with Query Caching in MII

    Hi All,
    I am facing a strange problem with Query caching in MII query. Have created one xacute query and set cache duration 30 sec. The associated BLS with the query retrieves data from SAP system. In the web page this value is populated by executing an iCommand. Followings are the steps I followed -
    Query executed for first time, it retrives data from SAP correctly. Lets say value is val1
    At 10th sec Value in SAP changed to val2 from val1.
    Query excuted at 15th sec, it gives value as val1. Which is expected as it gives from cache.
    Query is executed 1t 35th sec, it gives value as val2 retriving from SAP system. Which is correct.
    Query executed at 40th sec, it gives value as val1 from cache. Which is not expected.
    I have tried with java cache clear in browser and JCo cache of the server.
    Same problem I have seen for tag query also..
    MII Version - 12.0.6 Build(12)
    Any thoughts on this.
    Thanks,
    Soumen

    Soumen Mondal,
    If you are facing this problem from the same client PC and in the same session, it's very strange.. but if there are two sessions running on the same PC this kind of issue may come..
    Something about caching:
    To decide whether to cache a query or not, consider the number of times you intend to run the query in a minute. For data changing in seconds, and queried in minutes, I would recommend not to cache query at all.
    I may give a typical example for query caching in a query on material master cached for 24 hours, where we know that after creating material master, we are not creating a PO on the same day.
    BR,
    SB

  • Issue with query output

    hi there,
    I have an issue with the display of hours 00:00:00 in the query output in BW.
    The system assumes it as 0 or blank and therefore display it under unassigned hour.
    I am using the reference of 0TIME for this hourly display.
    When I checked the 0TIME i could not find the corresponding SID value for 00:00:00 hours.
    Can anybody please advise what needs to be done?
    Thanks in advance,
    Kind regard,
    Kate

    Hi Kate,
    I am experiencing the same problem as you: an InfoObject, created referencing 0TIME,  represented in the BEX Query as "#" when the Value is "00:00:00".
    How did you work it out?
    The Formula Variable strategy is not applicable in this case because 0TIME is not a key figure !
    Bye
    Aldo

  • Issue with calling procedure remotely

    Hello,
    Within the stored procedure, I am calling a procedure remotely but the '@v_remote_db' variable does not resolve:
    begin
    for i in cur_database_list loop
    v_remote_db := i.database_name;
    p_trunc_remote_table@v_remote_db; <<<------does not resolve
    end loop;
    end;
    Would work if obsolute value:
    p_trunc_remote_table@dev_db <------"works because dev_db is an actually database name and not a variable."
    The database link is correctly defined and works.
    Question: How to go around using obsolute value? I need to use a variable because the variable v__remote_db resolves to about 50 databases. Thank you.

    Duplicate thread:
    Re: issue with remote procedure calls
    Amiel

  • Forall issue when inserting on remote table

    Hi all,
    when I run this code, it works:
    forall i in 1..insCounter
    insert into table_name
    values(
    IdArray(i),
    RefererArray(i),
    UserAgentArray(i),
    LanguageArray(i));
    but when I try to do the same on a remote table(same structure):
    forall i in 1..insCounter
    insert into table_name@DBLINK
    values(
    IdArray(i),
    RefererArray(i),
    UserAgentArray(i),
    LanguageArray(i));
    all inserted values are null...
    Any idea?
    Thanks

    I've got very similar problem some months ago. After some back and forth stage I've realized that the problem was in some expressions in source query that used locally defined PL/SQL functions. It appeared that Oracle tried to execute this local functions on remote server and finalyy I've got an error
    ORA-04052: error occurred when looking up remote object <schema>.<package name>@<local server url>
    When I removed the calls to local functions everything began to work fine.
    What are exact expressions for columns in your
    select col_1,...,col_n
    from local_table
    Are there any function calls there?
    Cheers

  • Sling mapping issue with Query String

    For a button component, URL behaves differently with query string. Please let me know the sling mapping example for query string.
    Button component behavior across env:-
    Working Scenario:-
    - In Author edit mode, URL pointing to "/content/<websitelink>"
    - In Author preview mode shows URL "<host>:<port>/content/<websitelink>.html"
    - In Publisher mode shows URL, "<host>:<port>/<websitelink>", we do not want "/content" before website link so it is fine.
    Failure Scenario with query string:-
    - In Author edit mode URL pointing to "/content/<websitelink>?username=han"
    - In Author preview mode with URL "<host>:<port>/content/<websitelink>?username=han"
    - In Publisher mode, <host>:<port>/content/<websitelink>?username=han - Here we see the content, which is not acceptable in our scenario.
    Please let me know the mapping changes when we have a URL with query string.

    1) I assume you configure as per the rules mentioned in http://sling.apache.org/site/mappings-for-resource-resolution.html --> 'Mapping Entry Specification' under /etc/map. Based on the configuration in /etc/map and the website that we publish, it translates and shows all the applicable combination in the Felix console http://<host>:<port>/system/console/jcrresolver.
    2) How does Adobe CQ 5.4 resolve the right mapping, if we have multiple map folder like below in /etc directory with the same website with different rules.
    etc/map --> http --> <website> with property sling:match, sling:internalRedirect
    etc/map.publish --> http --> <website> with property sling:match, sling:internalRedirect
    etc/map.publish-stag --> http --> <website> with property sling:match, sling:internalRedirect
    Kindly clarify.

  • Issues with query using joins in 3 tables

    I am trying to fetch data from 3 tables (Project,RIsk and Issues) using join. There are Risks associated with some projects and Issues associated with some projects.
    ProjectID is primary key in Project table.
    RiskID is primary key in risk table. ProjectID is foreign key.
    IssueID is primary key in Issue table.ProjectID is foreign Key.
    I need the projectname, count of risks for projects, count of issues for projects. I am using joins in all the 3 tables. Issue here is, its giving me double of count of risks and issues for each project.
    Please advise how can I get the correct number. I have used the below query,
    select p.projectname,count(r.riskid),count(i.issueid) from project as p
    left outer join risk as r on p.projectid=r.projecctid
    left outer join issue as i on p.projectid=i.projectid
    group by
    p.projectname
    thanks

    Hi All,
    I got a new requirement to count, the number of high priority risks as well as high priority issues along with the other details. I modified the below table to include the changes, but I am not getting the desired result. Could you please help?
    Original query:
    select p.projectname,count(distinct r.riskid), count(distinct i.issueid) from project as p
    left outer join risk as r on p.projectid=r.projecctid
    left outer join issue as i on p.projectid=i.projectid
    group by p.projectname
    Modified query:
    select p.projectname,count(distinct r.riskid),sum(case when r.riskpriority='high' then 1 else 0 end), sum(case when i.issuepriority='high' then 1 else 0 end),count(distinct i.issueid) from project as p
    left outer join risk as r on p.projectid=r.projecctid
    left outer join issue as i on p.projectid=i.projectid
    group by p.projectnameI should get the desired result as:XYZ,8,1,4,4But I am getting:XYZ,8,4,4,32thanks for the reply.

  • Issue with Query Region with Table

    All,
    I have a Self Service Page , which has got a Query Region and an underlying Table.
    For the table/ Table Actions Region , I am setting the View Instance and View Attribute Programatically
    OATableBean myRequirementsBean =
    (OATableBean)webBean.findChildRecursive("MyReqTable");
    myRequirementsBean.setViewUsageName(voName);
    OAExportBean exportButtonBean =
    (OAExportBean)webBean.findChildRecursive("ExportButton");
    exportButtonBean.setViewUsageName(voName);
    OAWebBean ssWebBean = webBean.findIndexedChildRecursive("RadioSelect") ;
    ((OASingleSelectionBean)ssWebBean).setViewUsageName(voName);
    ((OASingleSelectionBean)ssWebBean).setViewAttributeName("RadioFlag");
    Followed by prepareForRendering call on Table Bean.
    myRequirementsBean.prepareForRendering(pageContext);
    When I render the Page , I can not see the Table Selection and see the Rows in Table alone.But if I navigate to Personalize View Page and come back to parent Page , I can see the Table Action.
    What could be the reason for this behavior? Please advise.
    Thanks
    Joseph George

    what item does RadioSelect refer to ? is it a child of the table bean ?
    Thanks
    Tapash

Maybe you are looking for