SQL statement taking a long time

Hi friends,
The below query is taking a very long time to execute. Please give some advise to optimise it.
INSERT INTO AFMS_ATT_DETL
    ATT_NUM,
    ATT_REF_CD,
    ATT_REF_TYP_CD,
    ATT_DOC_CD,
    ATT_FILE_NAM,
    ATT_FILE_VER_NUM_TXT,
    ATT_DOC_LIB_NAM,
    ATT_DESC_TXT,
    ATT_TYP_CD,
    ACTIVE_IND,
    CRT_BY_USR_NUM,
    CRT_DTTM,
    UPD_BY_USR_NUM,
    UPD_DTTM ,
    APP_ACC_CD,
    ARCH_CRT_BTCH_NUM,
        ARCH_CRT_DTTM,
    ARCH_UPD_BTCH_NUM ,
        ARCH_UPD_DTTM
  (SELECT
    K.ATT_NUM,
    K.ATT_REF_CD,
    K.ATT_REF_TYP_CD,
    K.ATT_DOC_CD,
    K.ATT_FILE_NAM,
    K.ATT_FILE_VER_NUM_TXT,
    K.ATT_DOC_LIB_NAM,
    K.ATT_DESC_TXT,
    K.ATT_TYP_CD,
    K.ACTIVE_IND,
    K.CRT_BY_USR_NUM,
    K.CRT_DTTM,
    K.UPD_BY_USR_NUM,
    K.UPD_DTTM ,
    L_APP_ACC_CD1,
    L_ARCH_BTCH_NUM,
    SYSDATE ,
    L_ARCH_BTCH_NUM ,
    SYSDATE
    FROM
        FMS_ATT_DETL K
    WHERE
     ( K.ATT_REF_CD IN
         (SELECT CSE_CD FROM T_AFMS_CSE_DETL  )  AND
        K.ATT_REF_TYP_CD ='ATTREF03'
     ) OR
         ATT_REF_CD IN
         (SELECT TO_CHAR(CMNT_PROC_NUM) FROM AFMS_CMNT_PROC ) AND
              ATT_REF_TYP_CD = 'ATTREF02'
         )    OR
         ATT_REF_CD IN
         (SELECT TO_CHAR(CSE_RPLY_NUM) FROM AFMS_CSE_RPLY ) AND
              ATT_REF_TYP_CD = 'ATTREF01'
    AND NOT EXISTS (SELECT ATT_NUM FROM (
      SELECT B.CSE_RPLY_NUM CSE_RPLY_NUM,B.ATT_NUM ATT_NUM FROM
        FMS_CSE_RPLY_ATT_MAP B
      WHERE
      NOT EXISTS
         (SELECT A.CSE_RPLY_NUM CSE_RPLY_NUM FROM AFMS_CSE_RPLY A WHERE A.CSE_RPLY_NUM  = B.CSE_RPLY_NUM)
    ) X WHERE X.ATT_NUM = K.ATT_NUM)
   ) ;

The explain plan for above query is as below:
PLAN_TABLE_OUTPUT
Plan hash value: 871385851
| Id  | Operation                | Name                    | Rows  | Bytes | Cos
t (%CPU)| Time     |
|   0 | INSERT STATEMENT         |                         |     9 |  1188 | 6  (17)| 00:00:01 |
|   1 |  LOAD TABLE CONVENTIONAL | AFMS_ATT_DETL           |       |       |        |          |
|*  2 |   FILTER                 |                         |       |       |        |          |
|*  3 |    HASH JOIN RIGHT ANTI  |                         |   167 | 22044 | 6  (17)| 00:00:01 |
|   4 |     VIEW                 | VW_SQ_1                 |     1 |    13 | 1   (0)| 00:00:01 |
|   5 |      NESTED LOOPS ANTI   |                         |     1 |    12 | 1   (0)| 00:00:01 |
|   6 |       INDEX FULL SCAN    | FMS_CSE_RPLY_ATT_MAP_PK |    25 |   200 | 1   (0)| 00:00:01 |
|*  7 |       INDEX UNIQUE SCAN  | AFMS_CSE_RPLY_PK        |   162 |   648 | 0   (0)| 00:00:01 |
|   8 |     TABLE ACCESS FULL    | FMS_ATT_DETL            |   167 | 19873 | 4   (0)| 00:00:01 |
|*  9 |    INDEX UNIQUE SCAN     | T_AFMS_CSE_DETL_PK      |     1 |     9 | 0   (0)| 00:00:01 |
|* 10 |    INDEX FULL SCAN       | AFMS_CSE_RPLY_PK        |     1 |     4 | 1   (0)| 00:00:01 |
|* 11 |    INDEX FULL SCAN       | AFMS_CMNT_PROC_PK       |     1 |     5 | 1   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   2 - filter("K"."ATT_REF_TYP_CD"='ATTREF03' AND  EXISTS (SELECT 0 FROM "T_AFMS_CSE_DETL"
              "T_AFMS_CSE_DETL" WHERE "CSE_CD"=:B1) OR "ATT_REF_TYP_CD"='ATTREF01' AND  EXISTS (SELECT 0
              FROM "AFMS_CSE_RPLY" "AFMS_CSE_RPLY" WHERE TO_CHAR("CSE_RPLY_NUM")=:B2) OR
              "ATT_REF_TYP_CD"='ATTREF02' AND  EXISTS (SELECT 0 FROM "AFMS_CMNT_PROC" "AFMS_CMNT_PROC"
              WHERE TO_CHAR("CMNT_PROC_NUM")=:B3))
   3 - access("ITEM_1"="K"."ATT_NUM")
   7 - access("A"."CSE_RPLY_NUM"="B"."CSE_RPLY_NUM")
   9 - access("CSE_CD"=:B1)
  10 - filter(TO_CHAR("CSE_RPLY_NUM")=:B1)
  11 - filter(TO_CHAR("CMNT_PROC_NUM")=:B1)

Similar Messages

  • Sql Query taking very long time to complete

    Hi All,
    DB:oracle 9i R2
    OS:sun solaris 8
    Below is the Sql Query taking very long time to complete
    Could any one help me out regarding this.
    SELECT MAX (md1.ID) ID, md1.request_id, md1.jlpp_transaction_id,
    md1.transaction_version
    FROM transaction_data_arc md1
    WHERE md1.transaction_name = :b2
    AND md1.transaction_type = 'REQUEST'
    AND md1.message_type_code = :b1
    AND NOT EXISTS (
    SELECT NULL
    FROM transaction_data_arc tdar2
    WHERE tdar2.request_id = md1.request_id
    AND tdar2.jlpp_transaction_id != md1.jlpp_transaction_id
    AND tdar2.ID > md1.ID)
    GROUP BY md1.request_id,
    md1.jlpp_transaction_id,
    md1.transaction_version
    Any alternate query to get the same results?
    kindly let me know if any one knows.
    regards,
    kk.
    Edited by: kk001 on Apr 27, 2011 11:23 AM

    Dear
    /* Formatted on 2011/04/27 08:32 (Formatter Plus v4.8.8) */
    SELECT   MAX (md1.ID) ID, md1.request_id, md1.jlpp_transaction_id,
             md1.transaction_version
        FROM transaction_data_arc md1
       WHERE md1.transaction_name = :b2
         AND md1.transaction_type = 'REQUEST'
         AND md1.message_type_code = :b1
         AND NOT EXISTS (
                SELECT NULL
                  FROM transaction_data_arc tdar2
                 WHERE tdar2.request_id = md1.request_id
                   AND tdar2.jlpp_transaction_id != md1.jlpp_transaction_id
                   AND tdar2.ID > md1.ID)
    GROUP BY md1.request_id
            ,md1.jlpp_transaction_id
            ,md1.transaction_versionCould you please post here :
    (a) the available indexes on transaction_data_arc table
    (b) the description of transaction_data_arc table
    (c) and the formatted explain plan you will get after executing the query and issuing:
    select * from table (dbms_xplan.display_cursor);Hope this helps
    Mohamed Houri

  • SQL Statement taking too long to get the data

    Hi,
    There are over 2500 records in a table and when retrieve all using ' SELECT * From Table' it is taking too long to get the data. ie .. 4.3 secs.
    Is there any possible way to shorten the process time.
    Thanks

    Hi Patrick,
    Here is the sql statement and table desc.
    ID     Number
    SN     Varchar2(12)
    FN     Varchar2(30)
    LN     Varchar2(30)
    By     Varchar(255)
    Dt     Date(7)
    Add     Varchar2(50)
    Add1     Varchar2(30)
    Cty     Varchar2(30)
    Stt     Varchar2(2)
    Zip     Varchar2(12)
    Ph     Varchar2(15)
    Email     Varchar2(30)
    ORgId     Number
    Act     Varchar2(3)     
    select A."FN" || '' '' || A."LN" || '' ('' || A."SN" || '')'' "Name",
    A."By", A."Dt",
    A."Add" || ''
    '' || A."Cty" || '', '' || A."Stt" || '' '' || A."Zip" "Location",
    A."Ph", A."Email", A."ORgId", A."ID",
    A."SN" "OSN", A."Act"
    from "TBL_OPTRS" A where A."ID" <> 0 ';
    I'm displaying all rows in a report.
    if I use 'select * from TBL_OPTRS' , this also takes 4.3 to 4.6 secs.
    Thanks.

  • Taking snapshot of oracle tables to sql server using transactional replication is taking a long time

    Hi All,
    I am trying to replicate around 200 oracle tables onto sql server using transaction replication and it taking a long time i.e the initial snapshot is taking more than 24 hrs and it still going on.
    Is there any way to replicate those these tables faster?
    Kindly help me out..
    Thanks

    Hi,
    According to the description, I know the replication is working fine. But it is very slow. 
    1. Check the CPU usage on Oracle publisher and SQL Server. This issue may due to slow client processing (Oracle performance) or Network performance issues.
    2. Based on SQL Server 2008 Books Online ‘Performance Tuning for Oracle Publishers’ (http://msdn.microsoft.com/en-us/library/ms151179(SQL.100).aspx). You can enable the transaction
    job set and follow the instructions based on
    http://msdn.microsoft.com/en-us/library/ms147884(v=sql.100).aspx.
    2. You can enable replication agent logging to check the replication behavior. You may follow these steps to collect them:
    To enable Distribution Agent verbose logging. Please follow these steps:
    a. Open SQL Server Agent on the distribution server.
    b. Under Jobs folder, find out the Distribution Agent.
    c. Right click the job and choose Properties.
    d. Select Steps tap, it should be like this:
    e. Click Run agent and click Edit button, add following scripts by the end of scripts in the command box:
            -Output C:\Temp\OUTPUTFILE.txt -Outputverboselevel 2
    f. Exit the dialogs
     For more information about the steps, please refer to:
    http://support.microsoft.com/kb/312292
    Hope the information helps.
    Tracy Cai
    TechNet Community Support

  • Discoverer reports taking a long time!!!

    Hi all,
    One of our clients is complaining that the discoverer reports are taking a long time to run for the last few days, the report used to take 30 minutes before but now is running for hours!!
    I have checked the SGA and I have killed the idle sessions but still there was no improvement in the performance.
    The version of BI discoverer is 10 and database also is 10g and the platform is win server 2003.
    I have checked the forums and they talk about explain plan and tkprof and other commands, but my problem is that i am unable to find the query that discoverer is running i mean once the report is clicked the query runs and gives the estimate time it would take. can some one tell me where this query is stored so that i can check this query,
    Also there were no changes made in the query or to the database.
    The temp space fills up 100%, i increased the size of temp space but still it goes to 100% also i noticed that the CPU utilisation goes to 100%
    i also increased the SGA but still no go.
    can someone kindly help me as to what could be causing this problem
    also kindly guide me to some good documents for tuning the discoverer.
    thanks in advance,
    regards,
    Edited by: user10243788 on Jan 4, 2010 12:47 AM

    Hi,
    The fact that the report used to work fast and now not can be related to many things but my guess is that the database statistics were changed and so the explain plan has changed.
    This can be done due to change in the volume of the data that crossed a level were oracle optimizer change the behavior but it can be other things as well.
    Anyway it is not relevant since it will be easier to tune the SQL than to find what have changed.
    In order to find whether the problem is with the discoverer or in the SQL extract the SQL as described above and run it in SQL tool (SQL Plus, TOAD, SQL Developer and so on).
    The best way to get to the problem is run a trace on your session and then use the TKPROF command to translate it to a text file you can analyze - you can assist your DBA team they should have no problem doing that.
    By doing that you will get the problematic statements/ functions/ procedures that the report uses.
    From there you can start working on improving the performance.
    Performance is expertise for itself so i'm sorry i don't know to tell you where to start from, I guess the start will be from understanding the meaning of the explain plan.
    Hope I helped a little although I wish Ii had a magic answer for you
    BTW, until you resolve that problem you can use the discoverer scheduler to run the reports in the background and so the users will get the data.
    Tamir

  • Issue in updating large number of rows which is taking a long time

    Hi all,
    Am new to oracle forums. First I will explain my problems as below:
    1) I have a table of 350 columns for which i have two indexes. One is for primary key's id
    and the other is the composite id (combination of two functional ids)
    2) Through my application, the user can calculate some functional conditions and the result
    is updated in the same table.
    3) The table consists of all input, intermediate and output columns.
    4) The only way of calculation is done through update statements. The problem is, for one
    complete process, the total number of update statement hits the db is around 1000.
    5) From the two index, one indexed column is mandatory in all update where clause. So one
    will come at any case but the other is optional.
    6) Updating the table is taking a long time if the row count exceeds 1lakh.
    7) I will now explain the scenario:
    a. Say there is 5lakh 100 records in the table in which mandatory indexed column id 1 has
    100 records and id 2 has 5 lakhs record.
    b. If I process id 1, it is very fast and executed within 10seconds. But if I process id 2,
    then it is taking more than 4 minutes to update.
    Is there any way to increase the speed of the update statement. Am using oracle 10g.
    Please help me in this, Since I am a developer and dont have much knowledge in oracle.
    Thanks in advance.
    Regards,
    Sethu

    refer the link:
    http://hoopercharles.wordpress.com/2010/03/09/vsession_longops-wheres-my-sql-statement/

  • When query is taking too long time

    When query is taking too long time,Where and how to start tuning it?
    Here i've listed few things need to be considered,out of my knowledge and understanding
    1.What the sql is waiting for(wait events)
    2.Parameter modification need to be done at system/session level
    3.The query has to be tuned (using hints )
    4.Gathering/deleting statistics
    List out any other things that need to be taken into account?
    Which approach must be followed and on what basis that approach must be considered?

    When query is taking too long time,Where and how to start tuning it?explain plan will be good start . trace also
    Here i've listed few things need to be considered,out of my knowledge and understanding
    1.What the sql is waiting for(wait events)When Oracle executes an SQL statement, it is not constantly executing. Sometimes it has to wait for a specific event to happen befor it can proceed.
    Read
    http://www.adp-gmbh.ch/ora/tuning/event.html
    2.Parameter modification need to be done at system/session levelDepend on parameter , define parameter , trace done on session level for example
    3.The query has to be tuned (using hints )Could be help you but you must know how to use .
    4.Gathering/deleting statisticsDo it in non working hours , it will impact on database performance , but its good
    List out any other things that need to be taken into account?Which account ?
    Which approach must be followed and on what basis that approach must be considered?you could use lot of tools , Trace , AWR

  • Time Machine Taking a Long Time to Index / Back Up

    Hi everyone.
    I noticed this on the latest backup to my Time Capsule device.  I'm backing up over a WiFi connection to a time capsule device.  It is taking a long time to index the backup.  Here's the code from the latest backup.
    10/17/12 9:43:03.799 PM com.apple.backupd: Starting standard backup
    10/17/12 9:43:04.091 PM com.apple.backupd: Attempting to mount network destination URL: afp://Michael%20Payne@Extreme%20Pleasantville._afpovertcp._tcp.local/Time%20Mac hine%20Backups
    10/17/12 9:43:12.657 PM com.apple.backupd: Mounted network destination at mountpoint: /Volumes/Time Machine Backups using URL: afp://Michael%20Payne@Extreme%20Pleasantville._afpovertcp._tcp.local/Time%20Mac hine%20Backups
    10/17/12 9:43:34.015 PM com.apple.backupd: QUICKCHECK ONLY; FILESYSTEM CLEAN
    10/17/12 9:43:37.440 PM com.apple.backupd: Disk image /Volumes/Time Machine Backups/Michael’s MacBook Pro.sparsebundle mounted at: /Volumes/Time Machine Backups 1
    10/17/12 9:43:37.459 PM com.apple.backupd: Backing up to: /Volumes/Time Machine Backups 1/Backups.backupdb
    10/17/12 9:45:23.296 PM com.apple.backupd: 500.1 MB required (including padding), 3.27 GB available
    10/17/12 9:46:48.844 PM com.apple.backupd: Copied 1436 files (3.4 MB) from volume Macintosh HD.
    10/17/12 9:46:51.897 PM com.apple.backupd: 448.1 MB required (including padding), 3.27 GB available
    10/17/12 9:46:51.898 PM com.apple.backupd: Waiting for index to be ready (100)
    10/17/12 9:47:53.681 PM com.apple.backupd: Waiting for index to be ready (100)
    10/17/12 9:48:55.642 PM com.apple.backupd: Waiting for index to be ready (100)
    10/17/12 9:49:56.511 PM com.apple.backupd: Waiting for index to be ready (100)
    10/17/12 9:50:56.564 PM com.apple.backupd: Waiting for index to be ready (100)
    10/17/12 9:51:57.643 PM com.apple.backupd: Waiting for index to be ready (100)
    10/17/12 9:52:57.903 PM com.apple.backupd: Waiting for index to be ready (100)
    10/17/12 9:53:59.341 PM com.apple.backupd: Waiting for index to be ready (100)
    10/17/12 9:55:01.281 PM com.apple.backupd: Waiting for index to be ready (100)
    10/17/12 9:56:03.171 PM com.apple.backupd: Waiting for index to be ready (100)
    10/17/12 9:57:03.966 PM com.apple.backupd: Waiting for index to be ready (100)
    10/17/12 9:58:33.083 PM com.apple.backupd: Copied 824 files (1.2 MB) from volume Macintosh HD.
    10/17/12 9:58:40.359 PM com.apple.backupd: Starting post-backup thinning
    10/17/12 9:59:51.851 PM com.apple.backupd: Deleted /Volumes/Time Machine Backups 1/Backups.backupdb/Michael’s MacBook Pro/2012-10-16-213620 (5.6 MB)
    10/17/12 10:00:17.440 PM com.apple.backupd: Deleted /Volumes/Time Machine Backups 1/Backups.backupdb/Michael’s MacBook Pro/2012-10-16-113505 (1.6 MB)
    10/17/12 10:00:30.046 PM com.apple.backupd: Deleted /Volumes/Time Machine Backups 1/Backups.backupdb/Michael’s MacBook Pro/2012-10-16-103509 (1.6 MB)
    10/17/12 10:00:43.781 PM com.apple.backupd: Deleted /Volumes/Time Machine Backups 1/Backups.backupdb/Michael’s MacBook Pro/2012-10-16-093513 (1.3 MB)
    10/17/12 10:00:43.781 PM com.apple.backupd: Post-back up thinning complete: 4 expired backups removed
    10/17/12 10:00:45.207 PM com.apple.backupd: Backup completed successfully.
    10/17/12 10:00:56.988 PM com.apple.backupd: Ejected Time Machine disk image.
    10/17/12 10:00:57.550 PM com.apple.backupd: Ejected Time Machine network volume.
    I am just curious as to why this is, and what I might do to fix it.  I did see one suggestion in another website suggesting diabling spolight indexing of the backup image with sudo mdutil -i off /Volumes/Time Machine Backups, but don't know where to type that in.  It then states to reenable it, but don't know where to type that in, either.  Any advice would be helpful.  I did run a verification not too long ago, and here's that code.
    10/14/12 3:44:14.289 PM com.apple.backupd: Backup verification requested by user.
    10/14/12 3:44:41.503 PM com.apple.backupd: Running backup verification
    10/14/12 4:04:31.602 PM com.apple.backupd: Backup verification passed!
    If any of you have or had a similar problem, I'd appreciate your help.  For the time being, I may just disable time machine during the evening, and only have it run during the day when I'm at work.

    Is your sig still current (10.7.3)? Or did you update to 10.7.5? Because 10.7.5 had a Spotlight/Time Machine bug that slowed down a lot of backups. If that's what it is, there's now a 10.7.5 Supplemental Update that fixes the slow Time Machine problem.
    If it isn't 10.7.5, I don't know what the problem might be.

  • Attribute Change run taking too long time to complete.

    Hi all,
    Attribute change run has been taking too long time to complete.It has to realign 50 odd aggreagates, some by delta , some by reconstruction. But inspite of all the aggregates it used to finish in quick time earlier. But since last 4-5 days it is taking indefinite time to finish.
    Can anyone please suggest what all reasons may be causing this? and what possibly can be the solution to the problem? It is becoming a big issue. So kindly help with ur advises.
    Promise to reward your answer liberally.
    Regards,
    Pradyut.

    Hi,
    Check with your functional owners in R/3 if there are mass changes/realignments or classification changes are going on regarding master data. e.g. reasigning materials to other material groups. This causes a major realignment in BW for all the aggregates. Otherwise check for parameterchanges / patches or missing db stats with your sap basis team.
    Kind regards, Patrick Rieken.

  • Reports taking unusually long time to load

    Gurus,
    I am using BO 4.1 SP1. I am trying to open a report  on BI launchpad. But it is taking very long time to load. This occurs even when i am trying to access the last instance. Window remains in the following state.
    I checked load on the server. But tha'ts fine. What could be the issue?

    Hi,
    Ok, that's strange because the connection server doesn't actually handle data processing.
    (that would typically be the WebiProcServer or DSL_Bridge or DF service (depending on workflow))
    My advice would be to turn off 'refresh on open',  change viewer technology to "web view" (as opposed to Java rich internet client)  and start investigating again from that baseline.
    Also, this might be indicative of a BIplatform sizing or APS configuration issue. another option: have you upped your memory allocation to the Tomcat config? 
    Regards,
    H

  • SM59 - Remote Logon taking very long time - RFC is receiver

    Hi Friends,
    We have ABAP connection (SM59) to R/3 system from PI system.  The connection test is fine. But, when we click the Remote Logon from SM59, it is taking very long time. It is unable to login.
    Due to this, messages are in scheduled state in the receiver CC monitoring. (SOAP to RFC - Async ). Receiver RFC CC also are green.
    We checked with R/3 team, the remote user which is used in SM59 is not locked in R/3 system and password also not changed.
    Friends, kindly clarify why it is taking very long time from PI in SM59 when the connection is fine.
    Kind regards,
    Jegathees P.

    Hi Sabarish,
    I checked in SM58. There are no entries.  SM59 is for other interfaces (IDoc).  In the Message Monitoring all messages showing 'To be Delivered' and 'Delivering' from yesterday onwards. In the CC monitoring, it shows 'Message Processing Started' from yesterday onwards. But not completed.
    I checked in SM21 take log of type 'RD'.  I doubt is this the correct log for this problem.
    The specified operating system call was returned with an error.        |
    For communication calls (receive, send, etc) often the cause of errors
    are network problems.
    It could also be a configuration problem at operating system level.
    (file cannot be opened, no space in the file system etc.).
    Additional specifications for error number 146
    Name for errno number ECONNREFUSED
    Interprocess communication (e.g. TCP/IP) connection refused by partner.
    |This usually means that the necessary receiver program is not running.
    Kindly clarify.
    Kind regards,
    Jegathees P.

  • Rank Function taking a long time to execute in SAP HANA

    Hi All,
    I have a couple of reports with rank function which is timing out/ or taking a really long time to execute, Is there any way to get the result in less time when rank functions are involved?
    the following is a sample of how the Query looks,
    SQL 1:
    select      a.column1,
                    b.column1,
                    rank () over(partition by a.column1 order by sum(b.column2) asc)
    from         "_SYS_BIC"."Analyticview1"         b
                    join          "Table1"            a
                      on          (a.column2 = b.column3)
    group by  a.column1,
    b.column1;
    SQL 2:
    select    a.column1,
                    b.column1,
                    rank () over( order by min(b.column1) asc) WJXBFS1
    from         "_SYS_BIC"."Analytic view2"         b
                    cross join                "Table 2"               a
    where      (a.column2  like '%a%'
    and b.column1  between 100 and 200)
    group by  a.column1,
                    b.column1
    when I visualize the execution plan,the rank function is the one taking up a longer time frame. so I executed the same SQL without the rank() or partition or order by(only with Sum() in SQL1 and Min() in SQL 2) even that took a around an hour to get the result.
    1.Does anyone have an any idea to make these queries to execute faster?
    2. Does the latency have anything to do with the rank function or could it be size of the result set?
    3. is there any workaround to implement these rank function/partition inside the Analytic view itself? if yes, will this make it give the result faster?
    Thank you for your help!!
    -Gayathri

    Krishna,
    I tried both of them, Graphical and CE function,
    It is also taking a long time to execute
    Graphical view giving me the following error after 2 hr and 36 minutes
    Could not execute 'SELECT ORDER_ID,ITEM_ID,RANK from "_SYS_BIC"."EMMAPERF/ORDER_FACT_HANA_CV" group by ...' in 2:36:23.411 hours .
    SAP DBTech JDBC: [2048]: column store error: search table error:  [2620] executor: plan operation failed
    CE function - I aborted after 40 mins
    Do you know the syntax to declare local variable to use in CE function?

  • Why this Query is taking much longer time than expected?

    Hi,
    I need experts support on the below mentioned issue:
    Why this Query is taking much longer time than expected? Sometimes I am getting connection timeout error. Is there any better way to achieve result in shortest time.  Below, please find the DDL & DML:
    DDL
    BHDCollections
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[BHDCollections](
     [BHDCollectionid] [bigint] IDENTITY(1,1) NOT NULL,
     [GroupMemberid] [int] NOT NULL,
     [BHDDate] [datetime] NOT NULL,
     [BHDShift] [varchar](10) NULL,
     [SlipValue] [decimal](18, 3) NOT NULL,
     [ProcessedValue] [decimal](18, 3) NOT NULL,
     [BHDRemarks] [varchar](500) NULL,
     [Createdby] [varchar](50) NULL,
     [Createdon] [datetime] NULL,
     CONSTRAINT [PK_BHDCollections] PRIMARY KEY CLUSTERED
     [BHDCollectionid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    BHDCollectionsDet
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[BHDCollectionsDet](
     [CollectionDetailid] [bigint] IDENTITY(1,1) NOT NULL,
     [BHDCollectionid] [bigint] NOT NULL,
     [Currencyid] [int] NOT NULL,
     [Denomination] [decimal](18, 3) NOT NULL,
     [Quantity] [int] NOT NULL,
     CONSTRAINT [PK_BHDCollectionsDet] PRIMARY KEY CLUSTERED
     [CollectionDetailid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    Banks
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Banks](
     [Bankid] [int] IDENTITY(1,1) NOT NULL,
     [Bankname] [varchar](50) NOT NULL,
     [Bankabbr] [varchar](50) NULL,
     [BankContact] [varchar](50) NULL,
     [BankTel] [varchar](25) NULL,
     [BankFax] [varchar](25) NULL,
     [BankEmail] [varchar](50) NULL,
     [BankActive] [bit] NULL,
     [Createdby] [varchar](50) NULL,
     [Createdon] [datetime] NULL,
     CONSTRAINT [PK_Banks] PRIMARY KEY CLUSTERED
     [Bankid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    Groupmembers
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[GroupMembers](
     [GroupMemberid] [int] IDENTITY(1,1) NOT NULL,
     [Groupid] [int] NOT NULL,
     [BAID] [int] NOT NULL,
     [Createdby] [varchar](50) NULL,
     [Createdon] [datetime] NULL,
     CONSTRAINT [PK_GroupMembers] PRIMARY KEY CLUSTERED
     [GroupMemberid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    ALTER TABLE [dbo].[GroupMembers]  WITH CHECK ADD  CONSTRAINT [FK_GroupMembers_BankAccounts] FOREIGN KEY([BAID])
    REFERENCES [dbo].[BankAccounts] ([BAID])
    GO
    ALTER TABLE [dbo].[GroupMembers] CHECK CONSTRAINT [FK_GroupMembers_BankAccounts]
    GO
    ALTER TABLE [dbo].[GroupMembers]  WITH CHECK ADD  CONSTRAINT [FK_GroupMembers_Groups] FOREIGN KEY([Groupid])
    REFERENCES [dbo].[Groups] ([Groupid])
    GO
    ALTER TABLE [dbo].[GroupMembers] CHECK CONSTRAINT [FK_GroupMembers_Groups]
    BankAccounts
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[BankAccounts](
     [BAID] [int] IDENTITY(1,1) NOT NULL,
     [CustomerID] [int] NOT NULL,
     [Locationid] [varchar](25) NOT NULL,
     [Bankid] [int] NOT NULL,
     [BankAccountNo] [varchar](50) NOT NULL,
     CONSTRAINT [PK_BankAccounts] PRIMARY KEY CLUSTERED
     [BAID] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    ALTER TABLE [dbo].[BankAccounts]  WITH CHECK ADD  CONSTRAINT [FK_BankAccounts_Banks] FOREIGN KEY([Bankid])
    REFERENCES [dbo].[Banks] ([Bankid])
    GO
    ALTER TABLE [dbo].[BankAccounts] CHECK CONSTRAINT [FK_BankAccounts_Banks]
    GO
    ALTER TABLE [dbo].[BankAccounts]  WITH CHECK ADD  CONSTRAINT [FK_BankAccounts_Locations1] FOREIGN KEY([Locationid])
    REFERENCES [dbo].[Locations] ([Locationid])
    GO
    ALTER TABLE [dbo].[BankAccounts] CHECK CONSTRAINT [FK_BankAccounts_Locations1]
    Currency
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Currency](
     [Currencyid] [int] IDENTITY(1,1) NOT NULL,
     [CurrencyISOCode] [varchar](20) NOT NULL,
     [CurrencyCountry] [varchar](50) NULL,
     [Currency] [varchar](50) NULL,
     CONSTRAINT [PK_Currency] PRIMARY KEY CLUSTERED
     [Currencyid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    CurrencyDetails
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[CurrencyDetails](
     [CurDenid] [int] IDENTITY(1,1) NOT NULL,
     [Currencyid] [int] NOT NULL,
     [Denomination] [decimal](15, 3) NOT NULL,
     [DenominationType] [varchar](25) NOT NULL,
     CONSTRAINT [PK_CurrencyDetails] PRIMARY KEY CLUSTERED
     [CurDenid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    QUERY
    WITH TEMP_TABLE AS
    SELECT     0 AS COINS, BHDCollectionsDet.Quantity AS BN, BHDCollections.BHDDate AS CollectionDate, BHDCollectionsDet.Currencyid,
                          (BHDCollections.BHDCollectionid) AS DSLIPS, Banks.Bankname
    FROM         BHDCollections INNER JOIN
                          BHDCollectionsDet ON BHDCollections.BHDCollectionid = BHDCollectionsDet.BHDCollectionid INNER JOIN
                          GroupMembers ON BHDCollections.GroupMemberid = GroupMembers.GroupMemberid INNER JOIN
                          BankAccounts ON GroupMembers.BAID = BankAccounts.BAID INNER JOIN
                          Currency ON BHDCollectionsDet.Currencyid = Currency.Currencyid INNER JOIN
                          CurrencyDetails ON Currency.Currencyid = CurrencyDetails.Currencyid INNER JOIN
                          Banks ON BankAccounts.Bankid = Banks.Bankid
    GROUP BY BHDCollectionsDet.Quantity, BHDCollections.BHDDate, BankAccounts.Bankid, BHDCollectionsDet.Currencyid, CurrencyDetails.DenominationType,
                          CurrencyDetails.Denomination, BHDCollectionsDet.Denomination, Banks.Bankname,BHDCollections.BHDCollectionid
    HAVING      (BHDCollections.BHDDate BETWEEN @FromDate AND @ToDate) AND (BankAccounts.Bankid = @Bankid) AND (CurrencyDetails.DenominationType = 'Currency') AND
                          (CurrencyDetails.Denomination = BHDCollectionsDet.Denomination)
    UNION ALL
    SELECT     BHDCollectionsDet.Quantity AS COINS, 0 AS BN, BHDCollections.BHDDate AS CollectionDate, BHDCollectionsDet.Currencyid,
                          (BHDCollections.BHDCollectionid) AS DSLIPS, Banks.Bankname
    FROM         BHDCollections INNER JOIN
                          BHDCollectionsDet ON BHDCollections.BHDCollectionid = BHDCollectionsDet.BHDCollectionid INNER JOIN
                          GroupMembers ON BHDCollections.GroupMemberid = GroupMembers.GroupMemberid INNER JOIN
                          BankAccounts ON GroupMembers.BAID = BankAccounts.BAID INNER JOIN
                          Currency ON BHDCollectionsDet.Currencyid = Currency.Currencyid INNER JOIN
                          CurrencyDetails ON Currency.Currencyid = CurrencyDetails.Currencyid INNER JOIN
                          Banks ON BankAccounts.Bankid = Banks.Bankid
    GROUP BY BHDCollectionsDet.Quantity, BHDCollections.BHDDate, BankAccounts.Bankid, BHDCollectionsDet.Currencyid, CurrencyDetails.DenominationType,
                          CurrencyDetails.Denomination, BHDCollectionsDet.Denomination, Banks.Bankname,BHDCollections.BHDCollectionid
    HAVING      (BHDCollections.BHDDate BETWEEN @FromDate AND @ToDate) AND (BankAccounts.Bankid = @Bankid) AND (CurrencyDetails.DenominationType = 'COIN') AND
                          (CurrencyDetails.Denomination = BHDCollectionsDet.Denomination)),
    TEMP_TABLE2 AS
    SELECT CollectionDate,Bankname,DSLIPS AS DSLIPS,SUM(BN) AS BN,SUM(COINS)AS COINS  FROM TEMP_TABLE Group By CollectionDate,DSLIPS,Bankname
    SELECT CollectionDate,Bankname,count(DSLIPS) AS DSLIPS,sum(BN) AS BN,sum(COINS) AS coins FROM TEMP_TABLE2 Group By CollectionDate,Bankname
    HAVING COUNT(DSLIPS)<>0;

    Without seeing an execution plan of the query it is hard to suggest something useful. Try insert the result of UNION ALL to the temporary table and then perform an aggregation on that table, not a CTE.
    Just
    SELECT CollectionDate,Bankname,DSLIPS AS DSLIPS,SUM(BN) AS BN,SUM(COINS)AS COINS  FROM
    #tmp Group By CollectionDate,DSLIPS,Bankname
    HAVING COUNT(DSLIPS)<>0;
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Query taking very long time

    DB 11.2.0.3.4
    Server HP-UX IA 11.31
    One big query is taking very long time. I am giving the explain plan along with stats from tkprof. If needed will give the query also. Can sombody tell me how can we improve this.
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1     23.26      23.90          0         20          0           0
    Execute      1   8055.11    9453.52     684215     348696   18750740     1306001
    Fetch        0      0.00       0.00          0          0          0           0
    total        2   8078.37    9477.42     684215     348716   18750740     1306001
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 322  (EDW_DM)   (recursive depth: 1)
    Rows     Row Source Operation
          0  LOAD TABLE CONVENTIONAL  (cr=352254 pr=684215 pw=682074 time=863655932 us)
    1306001   PX COORDINATOR  (cr=15823 pr=682074 pw=682074 time=499947892 us)
          0    PX SEND QC (RANDOM) :TQ20004 (cr=0 pr=0 pw=0 time=0 us cost=276195 size=126736955032 card=9998182)
          0     BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0      VIEW  VW_FCT_PLN_SUMM_ADL_WK_XARH317 (cr=0 pr=0 pw=0 time=0 us cost=276195 size=126736955032 card=9998182)
          0       UNION-ALL  (cr=0 pr=0 pw=0 time=0 us)
          0        SORT GROUP BY (cr=0 pr=0 pw=0 time=0 us cost=9167 size=95469948 card=378849)
          0         PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=9167 size=95469948 card=378849)
          0          PX SEND HASH :TQ20003 (cr=0 pr=0 pw=0 time=0 us cost=9167 size=95469948 card=378849)
          0           SORT GROUP BY (cr=0 pr=0 pw=0 time=0 us cost=9167 size=95469948 card=378849)
          0            HASH JOIN RIGHT SEMI (cr=0 pr=0 pw=0 time=0 us cost=2714 size=95469948 card=378849)
          0             BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0              PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=26 size=16428 card=4107)
          0               PX SEND BROADCAST :TQ20000 (cr=0 pr=0 pw=0 time=0 us cost=26 size=16428 card=4107)
       4857                VIEW  VW_SQ_1 (cr=47 pr=0 pw=0 time=25403 us cost=26 size=16428 card=4107)
       4857                 HASH JOIN  (cr=47 pr=0 pw=0 time=23353 us cost=26 size=229992 card=4107)
       1115                  TABLE ACCESS FULL DMN_PROD (cr=11 pr=0 pw=0 time=863 us cost=6 size=13380 card=1115)
       4873                  HASH JOIN  (cr=36 pr=0 pw=0 time=12991 us cost=20 size=180840 card=4110)
         55                   TABLE ACCESS FULL DMN_MKT_DEFN (cr=3 pr=0 pw=0 time=286 us cost=4 size=1980 card=55)
      18235                   TABLE ACCESS FULL FCT_MKT_PROD_BRDG (cr=33 pr=0 pw=0 time=13550 us cost=15 size=145880 card=18235)
          0             HASH JOIN  (cr=0 pr=0 pw=0 time=0 us cost=2686 size=93954552 card=378849)
          0              BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0               PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=111 size=403328 card=8768)
          0                PX SEND BROADCAST :TQ20001 (cr=0 pr=0 pw=0 time=0 us cost=111 size=403328 card=8768)
       8768                 NESTED LOOPS  (cr=274 pr=0 pw=0 time=15077 us cost=111 size=403328 card=8768)
          1                  NESTED LOOPS  (cr=5 pr=0 pw=0 time=203 us cost=5 size=28 card=1)
          1                   TABLE ACCESS FULL DMN_WK_END (cr=2 pr=0 pw=0 time=81 us cost=3 size=8 card=1)
          1                   TABLE ACCESS BY INDEX ROWID DMN_CALN (cr=3 pr=0 pw=0 time=110 us cost=2 size=20 card=1)
          1                    INDEX RANGE SCAN XNU1_DMN_CALN (cr=2 pr=0 pw=0 time=73 us cost=1 size=0 card=1)(object id 303867)
       8768                  TABLE ACCESS FULL DMN_CALN (cr=269 pr=0 pw=0 time=11719 us cost=106 size=157824 card=8768)
          0              PX BLOCK ITERATOR PARTITION: KEY KEY (cr=0 pr=0 pw=0 time=0 us cost=2573 size=76527498 card=378849)
          0               TABLE ACCESS FULL FCT_NONRET_SLS_CURR_TRANS_WKLY PARTITION: 32 32 (cr=0 pr=0 pw=0 time=0 us cost=2573 size=76527498 card=378849)
          0        BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0         PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=267028 size=2741509905 card=9619333)
          0          PX SEND ROUND-ROBIN :TQ20002 (cr=0 pr=0 pw=0 time=0 us cost=267028 size=2741509905 card=9619333)
    1284599           SORT GROUP BY (cr=15497 pr=682074 pw=682074 time=3839060439 us cost=267028 size=2741509905 card=9619333)
    6439189            FILTER  (cr=15486 pr=0 pw=0 time=57890179 us)
    8986531             PX COORDINATOR  (cr=279 pr=0 pw=0 time=52453034 us)
          0              PX SEND QC (RANDOM) :TQ10001 (cr=0 pr=0 pw=0 time=0 us cost=80940 size=2741509905 card=9619333)
          0               HASH JOIN  (cr=0 pr=0 pw=0 time=0 us cost=80940 size=2741509905 card=9619333)
          0                BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0                 PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=111 size=403328 card=8768)
          0                  PX SEND BROADCAST :TQ10000 (cr=0 pr=0 pw=0 time=0 us cost=111 size=403328 card=8768)
       8768                   NESTED LOOPS  (cr=274 pr=0 pw=0 time=14462 us cost=111 size=403328 card=8768)
          1                    NESTED LOOPS  (cr=5 pr=0 pw=0 time=345 us cost=5 size=28 card=1)
          1                     TABLE ACCESS FULL DMN_WK_END (cr=2 pr=0 pw=0 time=193 us cost=3 size=8 card=1)
          1                     TABLE ACCESS BY INDEX ROWID DMN_CALN (cr=3 pr=0 pw=0 time=136 us cost=2 size=20 card=1)
          1                      INDEX RANGE SCAN XNU1_DMN_CALN (cr=2 pr=0 pw=0 time=76 us cost=1 size=0 card=1)(object id 303867)
       8768                    TABLE ACCESS FULL DMN_CALN (cr=269 pr=0 pw=0 time=9447 us cost=106 size=157824 card=8768)
          0                PX BLOCK ITERATOR PARTITION: KEY KEY (cr=0 pr=0 pw=0 time=0 us cost=80801 size=2299020587 card=9619333)
          0                 TABLE ACCESS FULL FCT_PLN_RET_SLS_CURR_WKLY PARTITION: 30 30 (cr=0 pr=0 pw=0 time=0 us cost=80801 size=2299020587 card=9619333)
        834             NESTED LOOPS  (cr=15207 pr=0 pw=0 time=990747 us)
       2269              NESTED LOOPS  (cr=12938 pr=0 pw=0 time=1090852 us cost=17 size=56 card=1)
       2269               NESTED LOOPS  (cr=12101 pr=0 pw=0 time=1065238 us cost=16 size=20 card=1)
        834                TABLE ACCESS BY INDEX ROWID DMN_PROD (cr=1676 pr=0 pw=0 time=37175 us cost=1 size=12 card=1)
        838                 INDEX UNIQUE SCAN XPKDIMENSION_PRODUCT (cr=838 pr=0 pw=0 time=23645 us cost=0 size=0 card=1)(object id 303870)
       2269                TABLE ACCESS FULL FCT_MKT_PROD_BRDG (cr=10425 pr=0 pw=0 time=1024973 us cost=15 size=8 card=1)
       2269               INDEX UNIQUE SCAN SYS_C0040182 (cr=837 pr=0 pw=0 time=15842 us cost=0 size=0 card=1)(object id 301873)
        834              TABLE ACCESS BY INDEX ROWID DMN_MKT_DEFN (cr=2269 pr=0 pw=0 time=16488 us cost=1 size=36 card=1)
    It would be appreciated if somebody check this.
    Regards,
    Virendra

    Below is with the index on one of the table:
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1     49.33      49.61          0         16          0           0
    Execute      1   8374.08   10745.82     953712     473861   18818854     1306001
    Fetch        0      0.00       0.00          0          0          0           0
    total        2   8423.41   10795.43     953712     473877   18818854     1306001
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 322     (recursive depth: 1)
    Rows     Row Source Operation
          0  LOAD TABLE CONVENTIONAL  (cr=481416 pr=953712 pw=917687 time=2156047932 us)
    1306001   PX COORDINATOR  (cr=131828 pr=917687 pw=917687 time=1528317728 us)
          0    PX SEND QC (RANDOM) :TQ10004 (cr=0 pr=0 pw=0 time=0 us cost=144212 size=16362383616 card=1290816)
          0     BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0      VIEW  VW_FCT_PLN_SUM_ADL_WK_XRH317_1 (cr=0 pr=0 pw=0 time=0 us cost=144212 size=16362383616 card=1290816)
          0       UNION-ALL  (cr=0 pr=0 pw=0 time=0 us)
          0        SORT GROUP BY (cr=0 pr=0 pw=0 time=0 us cost=9568 size=101394468 card=402359)
          0         PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=9568 size=101394468 card=402359)
          0          PX SEND HASH :TQ10003 (cr=0 pr=0 pw=0 time=0 us cost=9568 size=101394468 card=402359)
          0           SORT GROUP BY (cr=0 pr=0 pw=0 time=0 us cost=9568 size=101394468 card=402359)
          0            HASH JOIN RIGHT SEMI (cr=0 pr=0 pw=0 time=0 us cost=2714 size=101394468 card=402359)
          0             BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0              PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=26 size=16428 card=4107)
          0               PX SEND BROADCAST :TQ10000 (cr=0 pr=0 pw=0 time=0 us cost=26 size=16428 card=4107)
       4857                VIEW  VW_SQ_1 (cr=47 pr=0 pw=0 time=25732 us cost=26 size=16428 card=4107)
       4857                 HASH JOIN  (cr=47 pr=0 pw=0 time=23041 us cost=26 size=229992 card=4107)
       1115                  TABLE ACCESS FULL DMN_PROD (cr=11 pr=0 pw=0 time=1040 us cost=6 size=13380 card=1115)
       4873                  HASH JOIN  (cr=36 pr=0 pw=0 time=12797 us cost=20 size=180840 card=4110)
         55                   TABLE ACCESS FULL DMN_MKT_DEFN (cr=3 pr=0 pw=0 time=185 us cost=4 size=1980 card=55)
      18235                   TABLE ACCESS FULL FCT_MKT_PROD_BRDG (cr=33 pr=0 pw=0 time=10014 us cost=15 size=145880 card=18235)
          0             HASH JOIN  (cr=0 pr=0 pw=0 time=0 us cost=2686 size=99785032 card=402359)
          0              BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0               PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=111 size=403328 card=8768)
          0                PX SEND BROADCAST :TQ10001 (cr=0 pr=0 pw=0 time=0 us cost=111 size=403328 card=8768)
       8768                 NESTED LOOPS  (cr=274 pr=0 pw=0 time=13429 us cost=111 size=403328 card=8768)
          1                  NESTED LOOPS  (cr=5 pr=0 pw=0 time=206 us cost=5 size=28 card=1)
          1                   TABLE ACCESS FULL DMN_WK_END (cr=2 pr=0 pw=0 time=82 us cost=3 size=8 card=1)
          1                   TABLE ACCESS BY INDEX ROWID DMN_CALN (cr=3 pr=0 pw=0 time=111 us cost=2 size=20 card=1)
          1                    INDEX RANGE SCAN XNU1_DMN_CALN (cr=2 pr=0 pw=0 time=80 us cost=1 size=0 card=1)(object id 303867)
       8768                  TABLE ACCESS FULL DMN_CALN (cr=269 pr=0 pw=0 time=9306 us cost=106 size=157824 card=8768)
          0              PX BLOCK ITERATOR PARTITION: KEY KEY (cr=0 pr=0 pw=0 time=0 us cost=2573 size=81276518 card=402359)
          0               TABLE ACCESS FULL FCT_NONRET_SLS_CURR_TRANS_WKLY PARTITION: 32 32 (cr=0 pr=0 pw=0 time=0 us cost=2573 size=81276518 card=402359)
          0        BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0         PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=134645 size=256764073 card=888457)
          0          PX SEND ROUND-ROBIN :TQ10002 (cr=0 pr=0 pw=0 time=0 us cost=134645 size=256764073 card=888457)
    1284599           HASH GROUP BY (cr=131502 pr=917687 pw=917687 time=1052831032 us cost=134645 size=256764073 card=888457)
    6439189            HASH JOIN RIGHT SEMI (cr=131490 pr=138092 pw=138092 time=374140098 us cost=100193 size=256764073 card=888457)
       4857             VIEW  VW_SQ_2 (cr=47 pr=0 pw=0 time=22869 us cost=26 size=16428 card=4107)
       4857              HASH JOIN  (cr=47 pr=0 pw=0 time=21073 us cost=26 size=229992 card=4107)
       1115               TABLE ACCESS FULL DMN_PROD (cr=11 pr=0 pw=0 time=687 us cost=6 size=13380 card=1115)
       4873               HASH JOIN  (cr=36 pr=0 pw=0 time=12522 us cost=20 size=180840 card=4110)
         55                TABLE ACCESS FULL DMN_MKT_DEFN (cr=3 pr=0 pw=0 time=242 us cost=4 size=1980 card=55)
      18235                TABLE ACCESS FULL FCT_MKT_PROD_BRDG (cr=33 pr=0 pw=0 time=9883 us cost=15 size=145880 card=18235)
    8986531             HASH JOIN  (cr=131443 pr=138092 pw=138092 time=402921160 us cost=100161 size=253210245 card=888457)
       8768              TABLE ACCESS FULL DMN_CALN (cr=269 pr=0 pw=0 time=11228 us cost=106 size=157824 card=8768)
    8986531              MERGE JOIN CARTESIAN (cr=131174 pr=138092 pw=138092 time=382931385 us cost=100049 size=237218019 card=888457)
          1               NESTED LOOPS  (cr=5 pr=0 pw=0 time=251 us)
          1                NESTED LOOPS  (cr=4 pr=0 pw=0 time=225 us cost=5 size=28 card=1)
          1                 TABLE ACCESS FULL DMN_WK_END (cr=2 pr=0 pw=0 time=127 us cost=3 size=8 card=1)
          1                 INDEX RANGE SCAN XNU1_DMN_CALN (cr=2 pr=0 pw=0 time=88 us cost=1 size=0 card=1)(object id 303867)
          1                TABLE ACCESS BY INDEX ROWID DMN_CALN (cr=1 pr=0 pw=0 time=17 us cost=2 size=20 card=1)
    8986531               BUFFER SORT (cr=131169 pr=138092 pw=138092 time=378126634 us cost=100047 size=212341223 card=888457)
    8986531                TABLE ACCESS BY GLOBAL INDEX ROWID FCT_PLN_RET_SLS_CURR_WKLY PARTITION: 30 30 (cr=131157 pr=0 pw=0 time=144384133 us cost=100044 size=212341223 card=888457)
    9066976                 INDEX RANGE SCAN SUBSTR_FCT_RET_SLS_CUR_WLY (cr=84385 pr=0 pw=0 time=93762049 us cost=83615 size=0 card=2856894)(object id 311617)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      os thread startup                               2        0.08          0.15
      PX Deq: Join ACK                                4        0.00          0.00
      PX Deq Credit: send blkd                      455        2.21         55.10
      PX Deq: Parse Reply                             4        0.01          0.01
      PX Deq: Execute Reply                      250046      247.89        439.12
      asynch descriptor resize                        9        0.00          0.00
      PX Deq Credit: need buffer                    549        1.54         15.84
      PX qref latch                                 235        0.01          0.18
      Disk file operations I/O                       42        0.00          0.00
      direct path write temp                      62665        0.25        365.50
      direct path read temp                       99442        0.46       1024.89
      db file sequential read                     36025        0.15        186.86
      latch: object queue header operation           17        0.00          0.00
      latch free                                      2        0.00          0.00
      log file switch (private strand flush incomplete)
                                                      1        0.07          0.07
      latch: messages                                 1        0.00          0.00
      log file switch completion                     14        0.08          0.79
      latch: cache buffers chains                     2        0.00          0.00
      latch: redo allocation                          1        0.00          0.00
      PX Deq: Signal ACK RSG                          4        0.06          0.07
      PX Deq: Signal ACK EXT                          4        0.00          0.01
      PX Deq: Slave Session Stats                     4        0.00          0.00
      enq: PS - contention                            1        0.00          0.00

  • OEM Grid Control taking a long time to load tablespace information

    We use OEM Grid control to monitor many dev/tst/prd databases. OEM is taking a long time to load the tablespace page information on one of our RAC databases (only one all other dbs ok). I have tried going to 1 instance in the environment and it still takes a long time to load the information about all tablespaces in this database. OEM Path is
    Cluster: crs > Cluster Database: sid > Database Instance: sid_instance1 > Tablespaces
    This is a development environment and it is not a very busy database at this time. Anyone else encounter an issue like this with OEM?
    Thanks in advance for any information

    user12192488 wrote:
    Purge your recyclebin. I had the same problem on one of our databases and realised that the recyclebin was very large. OEM uses the space from the recyclebin as well in order to load tablespace and datafile information.
    SQL> purge dba_recycebin;
    Worked for me.
    Regards,Thanks,
    It worked perfectly !
    It used to take 4 minutes to view my tablespaces in OEM !!! Now I have sub second response time !
    Still find it strange that the size of the recyclebin would have such an effect when viewing tablespace info in OEM. By the way it also sped up the viewing of datafiles in OEM.
    Regards,
    Mark T.

Maybe you are looking for

  • How to share a object library

    Dear Adobe Community, I am using the Adobe (JetForm) Output Designer Version 5.4.0. 130 As we are working in a team on several forms (IFDs), which include some objects from a object library, we would like to share the same library within the team. I

  • Hard drives failed and I need to download LR 5 again. How do I do that?  I can't find a number to call adobe.

    My computers rescently both died and I have had to replace the harddrives in both my MacBook and iMac. I had LR 5 on both computers but now have lost them. How can I download them again? Thank You, Emily

  • New iphoto11 install will not open in mountain lion

    i installed mountain lion and bought iphoto11 from the app store and and after installing iphoto it will not open i just get Process:         iPhoto [1190] Path:            /Applications/iPhoto.app/Contents/MacOS/iPhoto Identifier:      com.apple.iPh

  • Code for out/incoming call

    Dear all, Now I used Nokia N95 and I want to know the way that I can see the duration and number of incoming call and outgoing call in my phone. Before I used call log but after I change the Sim Card the information were deleted so how could I know i

  • Calling the CSV Export link in a Report Template

    I'm trying to have our "download" link appear on the bottom left rather then the default which is to the far right in Look 4. When I look at the source code, I can see how look 3 and 4 differ - different HTML table set-up and "align=right" for the li