This query may be fixed/rewritten?

Version: 11.2

The following query retrieves data from three sources. 1 query SELECT and 2 table (TAB1, tab 3) internal (TAB2).
The stats are updated in the tables involved. But this query is very slow. Any room for improvement?

This is the query
select sum(TAB2.N_AVL_BAL) as c1, sum(TAB2.N_AVL_BAL_LCY) as c2
  from WMS_XTDI_CUST TAB1,
  ( SELECT A.*
         FROM WMS_XTF_ACCT_BALANCE A
        INNER JOIN WMS_STDI_REPFLAG C
           ON A.C_CRM_INST = C.C_CRM_INST
          AND A.N_LATEST_REC_SEQ = C.N_REP_FLAG) TAB2, WMS_XTDI_CUST_ACCT_REL TAB3
        where (TAB1.C_CRM_INST = TAB3.C_CRM_INST and
              TAB1.ID_CUST = TAB3.ID_CUST and
              TAB2.C_ACCT_CCY = TAB3.C_ACCT_CCY and
              TAB2.C_CRM_INST = TAB3.C_CRM_INST and
              TAB2.C_SRC_SYST = TAB3.C_SRC_SYST and
              TAB2.X_ACCOUNT_NO = TAB3.X_ACCOUNT_NO and
              TAB1.X_RLSHIP_MGR_ID = '7883943')
The plan of the explain command
----------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                             | Name                   | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | Pstart| Pstop |
----------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                      |                        |     1 |    92 |       |   231K  (2)| 00:46:16 |       |       |
|   1 |  SORT AGGREGATE                       |                        |     1 |    92 |       |            |          |       |       |
|*  2 |   HASH JOIN                           |                        |  3527K|   309M|       |   231K  (2)| 00:46:16 |       |       |
|   3 |    PART JOIN FILTER CREATE            | :BF0000                |   233 |  3262 |       |    36   (0)| 00:00:01 |       |       |
|   4 |     TABLE ACCESS BY GLOBAL INDEX ROWID| WMS_XTDI_CUST          |   233 |  3262 |       |    36   (0)| 00:00:01 | ROWID | ROWID |
|*  5 |      INDEX RANGE SCAN                 | IDX_XT_CUST_08         |   233 |       |       |     3   (0)| 00:00:01 |       |       |
|*  6 |    HASH JOIN                          |                        |  2240K|   166M|   247M|   231K  (2)| 00:46:15 |       |       |
|   7 |     PART JOIN FILTER CREATE           | :BF0001                |  4556K|   195M|       |   163K  (2)| 00:32:44 |       |       |
|*  8 |      HASH JOIN                        |                        |  4556K|   195M|       |   163K  (2)| 00:32:44 |       |       |
|   9 |       PART JOIN FILTER CREATE         | :BF0002                |     6 |    54 |       |     3   (0)| 00:00:01 |       |       |
|  10 |        TABLE ACCESS FULL              | WMS_STDI_REPFLAG       |     6 |    54 |       |     3   (0)| 00:00:01 |       |       |
|  11 |       PARTITION RANGE ALL             |                        |    14M|   495M|       |   163K  (2)| 00:32:43 |     1 |    40 |
|  12 |        PARTITION LIST JOIN-FILTER     |                        |    14M|   495M|       |   163K  (2)| 00:32:43 |:BF0002|:BF0002|
|  13 |         TABLE ACCESS FULL             | WMS_XTF_ACCT_BALANCE   |    14M|   495M|       |   163K  (2)| 00:32:43 |     1 |   400 |
|  14 |     PARTITION LIST AND                |                        |  7096K|   223M|       | 40133   (1)| 00:08:02 |KEY(AP)|KEY(AP)|
|  15 |      TABLE ACCESS FULL                | WMS_XTDI_CUST_ACCT_REL |  7096K|   223M|       | 40133   (1)| 00:08:02 |KEY(AP)|KEY(AP)|
----------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access("TAB1"."C_CRM_INST"="TAB3"."C_CRM_INST" AND "TAB1"."ID_CUST"="TAB3"."ID_CUST")
   5 - access("TAB1"."X_RLSHIP_MGR_ID"='7883943')
   6 - access("A"."C_CRM_INST"="TAB3"."C_CRM_INST" AND "A"."C_ACCT_CCY"="TAB3"."C_ACCT_CCY" AND
              "A"."C_SRC_SYST"="TAB3"."C_SRC_SYST" AND "A"."X_ACCOUNT_NO"="TAB3"."X_ACCOUNT_NO")
   8 - access("A"."C_CRM_INST"="C"."C_CRM_INST" AND "A"."N_LATEST_REC_SEQ"="C"."N_REP_FLAG")

31 rows selected.
SQL >
SQL >


-Line account tables involved in the query
SQL> select count(*) From WMS_XTDI_CUST;

  COUNT(*)
----------
   1943009

SQL> select count(*) From WMS_STDI_REPFLAG;

  COUNT(*)
----------
         6

SQL> select count(*) From WMS_XTF_ACCT_BALANCE;

  COUNT(*)
----------
  14430174

SQL>
SQL> select count(*) from WMS_XTDI_CUST_ACCT_REL;

  COUNT(*)
----------
   7096125

Omega-3 wrote:
Thanks Jac.
I tested your version EXISTS in the query. But the result set is different.

Why you use two tables - WMS_XTDI_CUST TAB1 and WMS_XTDI_CUST_ACCT_REL?

No column is selected among them?

And it seems that they do not have a relationship 1:1 or n: 1 with the basic query...

Tags: Database

Similar Questions

  • No available connection to "Microsoft difficulty it Center Online"-"this site may be experiencing a problem.

    Login page Microsoft Fix It says:

    • This site may be experiencing a problem
    • The site may not be a member of the Windows Live network

    You can:

    • You can connect or sign up at other sites on the Windows Live network, or try again later at this site.

    There is no way to connect.   I have personally observed this situation is the case for a few days.  So maybe this problem, please?

    the URL for this page is: https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=11&ct=1312745636&rver=6.0.5285.0&wp=MBI&wreply=http:%2F%2Ffixitcenter.support.microsoft.com%2FPortal&lc=1033&id=266967

    Hello

    There is a forum dedicated to issues related to Microsoft fix it Center: http://social.microsoft.com/Forums/en-US/fixitcenter/threads

    I suggest post you your query in Microsoft fix it in the forum for better assistance Center.

  • I have Firefox 10.0.1 for several days, and I lost all the favicons on my favorites. I thought that this problem has been fixed in V 10. Someone at - it a solution?.

    I have a pc running Windows 7 64 bit. I have the latest Firefox V 10.0.1, automatically updated several days ago. Everything was fine until about an hour before, when I launched Firefox and all the Favicons for my favorites are blank dotted squares. I checked this forum and found that this problem should be fixed at 10 V. well, he's back.

    What is the solution?

    I can understand why the favicons have been lost. Earlier today, I ran the story of Vipre Antivirus to address another question I've had. Who may have somehow caused the favicons to clear.

    Thanks cor - el for your suggestion. I ran of CheckPlaces and selected 'Reload favicons. He charged more, but not all. I also discovered that just open the bookmark, the favicon for the site gets reloaded. So those CheckPlaces cannot charge, I can recharge by simply opening the bookmark.

    Maybe someone can explain to me why the history cleaner wiped out the first bookmark favicons.

  • How can I stop this > a script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script ends. Script: file:///C:/Program%20Files/Mozilla%20Firefox/components/nsExtensionMana

    What is the cause of the WARNING when I open firefox and how can I fix it? > A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script ends.

    Script: file:///C:/Program%20Files/Mozilla%20Firefox/components/nsExtensionManager.js:623 <

    This has happened

    A few times a week

    From what I can tell, you have the toolbar installed, and which is known to cause problems. Go in Tools > Modules > Extensions, select the Ask toolbar, click disable , and then restart Firefox.

    If it does not, your troubleshooting details. See using the page of troubleshooting information to help solve the problems of Firefox

  • A script on this page may be busy, or it may have stopped responding.

    original title: help please!

    I am a novice with computers a hopin some1 can help as I do not understand the technical terms, I get the followin problem I av done any malware scans a spybot too system restore also hasn't fixed it the follow-up message keeps comin up on firefox a google chrome

    A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script ends.

    Script: / * potentially dangerous link to the deleted .js script * /.

    can any1 help with software link 4 that will correct this problem please you very much thank you chris

    the https://s-static.ak.fbcdn.net/rsrc.php/v2/y3/r/rtwojj04NdT.js:51 script is from facebook so I doubt that its dangerous as such.

    You can install firefox here site blockers

    https://addons.Mozilla.org/en-us/Firefox/addon/BlockSite/

    and block the url:

    https://s-static.AK.fbcdn.NET/rsrc.php/v2/Y3/r/rtwojj04NdT.js:51

    see if it works ;)

    I think I found the problem, I think it is the avg firewall as I am now runnin avast one do not have the problem at the mo so thanks 4 every1s help hope this can help u if you get the same problem

  • How to optimize this query?

    Hello

    I have a query like this:

    Merge into the table st1

    using (select * from (select pk, value, diff_value, m_date, row_number () over (PARTITION pk ORDER BY diff_value) rnk)

    from (select distinct / * + Full (t1) full (t2) * / t1.pk, t2.m_date)

    , Case when (t1.m_date = t2.m_date) then "CORRESPONDENCE".

    When (t2.m_date BETWEEN t1.m_date-1 and t1.m_date + 1) then ' MATCHED WITH +/-1gg.

    When (t2.m_date BETWEEN t1.m_date-2 and t1.m_date + 2) then "MATCHED WITH +/-2 days.

    else "

    end value_match

    Case when (t1.m_date = t2.m_date) then 0

    Where (t2.m_date BETWEEN t1.m_date + 1 and t1.m_date - 1) then 1

    Where (t2.m_date BETWEEN t1.m_date + 1 and t1.m_date - 1) then 2

    else "

    end diff_value

    of table t2, t1 table

    where t1.value is null

    and t1.id = t2.id)

    where value_match is not null)

    where rnk = 1) s

    on (st1.pk = s.pk)

    WHEN MATCHED THEN

    Update set st1.value = s.value_match, st1.diff_value = s.diff_value, st1.up_date = s.m_date

    where st1.value is null.

    Explain the plan:

    EXPLAIN_PLAN1.jpg

    Table1 a record 3Million and table 2 has 1 million records.

    I used gather stats before you run this query and 'Full' trick, even in this case, he is running for 45 minutes.

    Please suggest the best solution to optimize this query.

    Thanks in advance.

    Remove the tips.

    No need for the separate.

    Get the diff by ceil (abs(t2.m_date-t1.m_date)) and the filter for that where value_diff<>

    Assing the statement ".. MATCHED" lately in the update clause.

    Maybe give exactly to your needs with a small example may be the query may be getting more simplified or not what you want it to do.

  • "This document may not be printed, no pages have been selected for print".

    When I go to print, Adobe Reader said "this document may not be printed, no pages have been selected for print". Has anyone experience this problem? And if so, how you go about fixing it?

    Hi cindeer74034810,

    Try the following: open Adobe Reader go to edit-> Preferences menu

    • under Documents, change "Show the documents in PDF/A mode" Never
    • under the (enhanced) protection, clear protected at Startup Mode

    Let me know if the problem persists.

    Kind regards

    Nicos

  • Rewrite this query

    How to rewrite this query. It took more than 30 minutes

     SELECT  t.svc_ord_nbr
         FROM (SELECT a.svc_ord_nbr
                 FROM m04_nt_uv_ord_admin a, m04_cct_nbr_range b
                WHERE a.adabas_isn = b.adabas_isn) t where t.svc_ord_nbr not in (select c.SVC_ORD_NBR
                                                                       from  m04_nt_uv_ord_admin c
                                                                       having count(*)>1
                                                                       group by c.svc_ord_nbr)

    May use are:

    /* Formatted on 2012/06/18 17:36 (Formatter Plus v4.8.8) */
    SELECT t.svc_ord_nbr
      FROM (SELECT a.svc_ord_nbr
              FROM m04_nt_uv_ord_admin a, m04_cct_nbr_range b
             WHERE a.adabas_isn = b.adabas_isn) t
     WHERE NOT EXISTS (SELECT   1
                           FROM m04_nt_uv_ord_admin c
                          WHERE t.svc_ord_nbr = c.svc_ord_nbr
                         HAVING COUNT (*) > 1
                       GROUP BY c.svc_ord_nbr)
    
  • Nothing wrong with this query?

    I tried to create a report based on this query:

    SELECT call_type.call_type_detail, code_city.code_city_detail, area_code.area_code_detail, call_reason.call_reason_detail, cform.cform_phone_number_body, call_outcome.call_outcome_detail, outcome_reason.outcome_reason_detail, cform.cform_date_time, cform.cform_comments
    OF call_type code_city area_code, call_reason, Carousel, call_outcome, outcome_reason

    I checked all the fields to make sure they match, and when I try to test CFR blocks... any idea why this may be the case? Thank you!

    The funny is I was already using inner join, but did not know who called him and not add to the post because I have quite a few variables as criteria and thought that it would make it difficult to understand. Ultimately it was stalled due to an error in a table, that I was not specified correctly.

    That's what I had from the start!

    SELECT call_type.call_type_detail, code_city.code_city_detail, area_code.area_code_detail, call_reason.call_reason_detail, cform.cform_phone_number_body, call_outcome.call_outcome_detail, outcome_reason.outcome_reason_detail, cform.cform_date_time, cform.cform_comments

    OF call_type code_city area_code, call_reason, Carousel, call_outcome, outcome_reason

    WHERE cform.cform_date_time BETWEEN #CreateODBCDateTime (param. CustomFullStartDate) # AND #CreateODBCDateTime (param. CustomFullEndDate) # AND cform.cform_call_product = #param. Cform.call_service = GetCustomProduct # AND #param. GetCustomService # AND cform.cform_call_reason = #param. GetCustomCallReason # AND cform.cform_call_outcome = #param. GetCustomCallOutcome # AND cform.cform_call_outcome_reason = #param. GetCustomReason # AND call_type.call_type_id = cform.cform_call_type AND call_city.call_city_id = cform.cform_call_city AND area_code.area_code_id = cform.cform_area_code AND call_reason.call_reason_id = cform.cform_call_reason AND call_outcome.call_outcome_id = cform.cform_call_outcome AND outcome_reason.outcome_reason_id = cform.cform_outcome_reason AND cform.cform_date_time

  • Is it possible to set this query...

    This query takes 10 minutes to run on Windows 2003, raid10, Oracle 10.2.0.4.Is it doesn't matter what part I can watch in optimizing the query...

    Withdrawal of the request...
    Published by: Maran Viswarayar on 13 Nov 2009 13:51

    Published by: Maran Viswarayar on November 16, 2009 14:58

    Try something like this I tested with the substr function:

    SQL> select substr(pad,2,3) from t where id=368;
    
    SUB
    ---
    WET
    
    SQL> select substr((select pad from t where id=368),2,3) from dual;
    
    SUB
    ---
    WET
    

    I used the sql statement to replace the function parameter. Of course, it's stupid to use this way, if you do not need to do, but for your case, this could be a solution. In your case, you could write:

    FROM TABLE (ADMIN.find_record_dtl (
                         8,
                         (select SUBSTR(pc.pay_calendar_id, 0,3) from pr_calendar pc where  = SUBSTR(pc.pay_calendar_id, 0,3) = 'RET')),
                         'HQPRM003')
    

    Therefore, you put any sql that returns the correct value for your second parameter to your function entry. I hope that I wrote the right of expression, like yesterday, I got some garbage inside the text when I copied it.

    From the performance point of view I wouldn't function to extract the lines although it uses in BULK COLLECT but would rather use SQL function and integrate it within the main query and get something like:

    ...FROM( SELECT  DISTINCT pc.pay_calendar_id,
                     CASE WHEN ...
                     END AS pay_amount,
               rd.employee_id, cal_month, data_name, data_desc, data_seq
               FROM (SELECT distinct report_id, employee_id,  employee_name,
                                     pay_calendar_id, data_name, data_desc,
                                  data_seq, display_name, section_seq,
                                  item_id, base_amt, input_amt,
                                  calculated_amt
                        FROM list_record_dtl) rd,
                            pr_calendar pc
                 WHERE pc.pay_calendar_id = rd.pay_calendar_id
                 AND   SUBSTR(pc.pay_calendar_id, 0,3) = 'RET'
                 AND   rd.employee_id = 'HQPRM003'
                       and   rd.report_id = 8 ) a
             RIGHT JOIN ....
    

    So now you have two options yet :-)

    Generally, I would prefer rather to not use the service for the following reasons:
    (1.) the change of context between engine sql and pl/sql - Fortunately, in your case the function is executed only once (see column starts from your execution plan)
    2.) xxx of the instances of the type of data pay_item_t to the result of the query within the service may use lots of memory. This memory is allocated to the PGA and would be seen in v$ process_memory in the category 'other '. Of course, you can also monitor the consumption of memory of PGA of v$ sesstat. Now you will use the three parameters to the function and fewer rows returned as it was before, when the function has returned 192076 lines.
    3.) and the last one the more important one - if you use the online mode you give the CBO opportunity to optimize instruction. If you are using the CBO cannot push the predicates of main query within the query that is executed within the function and so it can be like a suboptimal plan even what exactly was your case when you started this thread. Was clearly the person who developed the conscious function of this problem and has tried to solve this problem by additional parameters that are passed to the function and are used to limit the number of rows returned by the function. Unfortunately these two parameters were not used in your case.
    4.) it is always a good practice using only the resources you really need and not much more!

    Published by: Scheid Joze on 19.11.2009 10:50

  • What can I do to prevent the failure of this query

    Someone used our search engine to submit the search term "NT the Australia".

    With the help of Barbara in several positions before this one, we have a thesaurus that transforms "NT" in "Northern Territory".

    If the "analysis function" I wrote eventually transform the search of this query string:
    select * from search_table where contains(keyfield,'(nt|northern territory) and (australia)')>0
    But which causes this error:

    -20000:ORA - 20000: Oracle Text error: DRG-10800: failed to query:

    I assume that the problem is "NT", which is taken to mean 'short term', rather than the State abbreviation. The same type of problem that can occur when someone searches for BT, which means 'British Telecom', but I imagine that this will be interpreted to mean "generic term".

    What is the usual way to stop these kinds of questions? I can write the code that replaces "NT" by "northern territory" before I even touched my dictionary of synonyms... but if I'm going to hardcode things like that, what else I'd be worried? And although I could replace 'BT' by 'british telecom', I imagine that anyone who wants to seek 'the confidence of bankers' could have a surprise if I.

    Is it all consistent, sensible, ways to deal with this kind of issue that does not imply that users think reading the spirit?

    "You say, I think, it was a stupid move and that there is no harm in putting each search term all about braces? "'({WOMAN}) and (HAT {})' would be just as acceptable, as fast as the '(femme et chapeau)? »

    Fix.

  • Apple airport extreme - this unit may be overheating message and blinking orange light

    I see constant flashing light of Ember and the message "this device may be overheating" in airport utility.

    Is what model? Questions over overheating are high AC version. If this isn't the case, please give the number of actual model of the base, A1xxx.

    The fan may hang with dust... details in airport utility should give you this info.

    The foregoing applies only to the model AC Extreme and TC.

  • How the sender can resolve this message may be a scam?

    How the sender can resolve this message may be a scam?

    When your question has been answered can mark you the thread as "Solved" Please?
    Thank you.

  • I get the same message: a script on this page may be busy, or it may have stopped responding

    Since a couple of days I get the same error message: "a script on this page may be busy, or it may have stopped responding." You can stop the script now, open the script in the debugger, or let the script continue. »

    I'm not a COMPUTER expert, however, I have read similar online messages and tried many steps such as:
    --deleting history navigation and cookies
    -Mozilla resetting to the factory settings
    -Uninstall and reinstall Mozilla

    Unfortunately, the problem is always the same. What can I do? I work from home and need internet to work 100%.

    Moreover, the navigation works fine in other browsers, but not Mozilla.

    Thank you

    This script is the culprit in the following message?

    A script on this page may be busy, or it may have stopped responding. You can stop the script now, open the script in the debugger or let the script.

    Script: resource://gre/modules/addons/XPIProvider.jsm-> jar:file:///C:/Program%20Files/Mozilla%20Firefox/browser/extensions/%7B82AF8DCA-6DE9-405D-BD5E-43525BDAD38A%7D.xpi!/bootstrap.js-> resource://gre/modules/commonjs/toolkit/loader.js-> resource://gre/modules/commonjs/sdk/loader/sandbox.js-> resource://skype_ff_extension-at-jetpack/skype_ff_extension/data/jquery-2.1.0.min.js:28

  • Why do I get the message "a script on this page may be busy, or it may have stopped responding." You can stop the script now, or you can continue to s?

    I have 3 windows firefox with several tabs in each, but the main (and sometimes others) gel and prevent navigation showing a box indicating
    "A script on this page may be busy, or it may have stopped responding." You can stop the script now, or you can continue to see if the script ends.

    "Script: chrome://fctoolbar841468a1d7f44bd384e6bb0f13a06c64/content/fctoolbar.js:1.
    To stop the script? I think it's not to do with Google Chrome but FF model internal to web pages. Thus, a deficiency in the FF, inability to cope, but with what? As far as I KNOW, all software is up-to-date. I have restarted FF, restarted the laptop, but has not changed the FF problem. What is the cause?

    This is probably caused by a toolbar that installs on your version of Firefox. Most of the scripts that begin with chrome:// are extensions.
    I think that this is very probably the Nectar Search Toolbar , which raises the question, because it seems to be the only toolbar installed on your computer.

    Try Firefox Safe mode to see if the problem goes away. Firefox Safe mode is a troubleshooting mode that disables certain parameters, disables most Add-ons (extensions and themes).

    If Firefox is open, you can restart Firefox Safe mode in the Help menu:

    • In Firefox 29,0 and above, click on the menu button

      click Help

      then select restart with disabled modules.

    • In previous versions of Firefox, click on the Firefox button in the upper left of the Firefox window and click help (or click on help in the Menu bar, if you do not have a Firefox button) and click on restart with disabled modules.

    If Firefox is not running, you can start Firefox in Mode safe mode as follows:

    • On Windows: Hold down the SHIFT key when you open the desktop Firefox or shortcut in the start menu.
    • On Mac: Hold the option key during the startup of Firefox.
    • On Linux: Exit Firefox, go to your Terminal and run firefox-safe-mode
      (you may need to specify the installation path of Firefox for example/usr/lib/firefox)

    When the Firefox Safe Mode window appears, select "start mode safe."

    If the issue is not present in Firefox Safe Mode, your problem is probably caused by an extension, and you need to understand that one. Please follow the section Troubleshooting extensions, themes and problems of hardware acceleration to resolve common Firefox problems to find the cause.

    To exit safe mode of Firefox, simply close Firefox and wait a few seconds before you open Firefox for normal use again.

Maybe you are looking for

  • manipulation of file/folder Win 8.1Thunderbird very slow

    Long story short: Win 7 has been corrupted, so I installed Win 8.1. All programs work well, with the exception of Thunderbird. Any action of Thunderbird is extremely slow, up to a few minutes to perform any action. The program is unusable in normal w

  • Font change

    I just bought my first Sony Vaio and everything is great EXCEPT my fonts random small to large changes. I know I can ctrl +/-to change it but I certainly do not do it every time? I looked everywhere on the internet to try to fix it myself, but I'm no

  • Device simulated in MAX, auto test without error and has work Test panels, but is not displayed in the DAQ assistant.

    I am trying to create a development machine, where we can test the new code without using our physical hardware. I followed this guide to set up a system of simulation. I get to step 3.2 b, but the device does not appear in the DAQ assistant. MAX, th

  • Envy 15 BEATS 3040NR audio dial/button replacement

    I got this laptop from a friend for free, it is out of warranty and I had the problem of button sticking audio BEATS feared the second time I tried to turn on the laptop. It seems quite common problem and I basically disconnected the button/wheel of

  • HM Prm Vista 64-bit; no updates in a month

    I have the same problem, and so far, I've done EVERYTHING on the internet to resolve this issue, register the DLLs needed to download the latest version of the Update Manager (when I ran, he stated that he had suffered an unrecoverable error) and not