Script is taking long time to finish...Need Optimization Suggestion.

Hi All:
I have written below script and this script is successfully executing and deriving the correct results. But this script is taking 4 hours to complete, can you please suggest on how to improve its performance. The requirement is to run this script is less than an hour.
Any suggestion will be of great help for me . Thanks, UB
SET UPDATECALC OFF;
SET CLEARUPDATESTATUS OFF;
SET LOCKBLOCK HIGH;
SET CALCPARALLEL 7;
SET CREATEBLOCKONEQ ON;
FIX (@RELATIVE("Calculated Amounts",0), @RELATIVE("Projects",0),@RELATIVE("Business Units",0),@RELATIVE("Geography",0),@LIST(@RELATIVE("2008",0),@RELATIVE("2009",0),@RELATIVE("2010",0)))
DATACOPY "Draft" TO "Plan Iteration-1";
     FIX ("Plan Iteration-1")
     CCONV "CurrentMonth"->"EUR";
ENDFIX
DATACOPY "Plan Iteration-1" TO "Plan Iteration-2";
ENDFIX
ENDFIX

I am not sure if it would make a difference since SET COPYMISSINGBLOCK OFF suppresses the creation of missing blocks during copy of data from a dense dimension.
http://download.oracle.com/docs/cd/E12825_01/epm.111/esb_techref/set_copymissingblock.htm

Similar Messages

  • Aggregation script is taking long time - need help on optimization

    Hi All,
    Currently we are working to build a BSO solution (version 11.1.2.2) for a customer where we are facing performance issue in aggregating the database. The most common activity of the solution will be to generate data on different scenario from Actual and Budget (Actual Vs Budget difference data in one scenario) and to be used for reporting purpose mainly.
    We are aggregating the data to top level using AGG command for Sparse dimensions. While doing this activity, we found that it is creating a lot of page files and thereby filling up the present physical memory of the drive (to the tune of 70GB). Moreover it is taking a long time to aggregate. The no. of stored members that is present are as follows:
    Dimension - Type - Stored member (Total members)
    Account - Dense- 1597 (1845)
    Period - Dense - 13 (19)
    Year - Sparse - 11 (12)
    Version - Sparse - 2 (2)
    CV - Sparse- 5 (6)
    Scenario - Sparse - 94 (102)
    EV - Sparse - 120 (122)
    FC - Sparse- 118 (121)
    CP - Sparse - 1887 (2049)
    M1 - Sparse - 4873 (4874)
    Entity - Sparse - 12020 (32349) - Includes two alternate hierarchies for rolling up the data
    The other properties are as follows:
    Index Cache - 152000
    Data File Cache - 32768
    Data cache - 153600
    ACR = 0.65
    We are using Buffered I/O
    The level 0 datafile is about 3 GB.( 2 year budget and 1 year 2 months Actuals data)
    Customer is going to use SmartView to retrieve the data and having Planning Plus License only. So could not go for an ASO solution. We could not reduce the members of huge Sparse dimensions M1 and CP as well. To improve the data retrieval time, we had to make upper level members as stored which resolved data retrieval issue
    I am seeking for help on the following:
    1. How can we optimize the time taken? Currently each dimension is taking about an hour to aggregate. Calc Dim is taking even longer time. Hence opted for AGG
    2. Will change of dense and sparse setting help our cause? ACR is ona lower side. Please note that most calculations are either on Period dimensions or FC. There is no such calculation on Account dimension
    3. Will change of a few non-level 0 members from store to dynamic-calc help? Will this slow down calculations in the cube?
    4. What should be the best performance order for this cube?
    Appreciate your help in these regard,
    Regards,
    Sukhamoy

    Please provide following  information
    1)  Block size  and other statistic
    2)  Aggreagation script
    >>Index Cache - 152000
    >>Data File Cache - 32768
    >>Data cache - 153600
    Try this settings
    Index Cache - 1120000
    Data cache - 3153600

  • 0WBS_ELEMT DTP is taking long time to finish

    Hi ,
    Data load from PSA to data target(0WBS_ELEMT) is taking very long time for around 1.2 lakhs data .while uploading data from source to PSA it is taking only 5 to 10 mins but from PSA to target it is taking around 2 hours where as earlier it used to take only 15 mins to finish.
    There are no changes done for this object ,no increase of data volume and no corresponding transports moved to production also.
    we have changed the data packet size also but it is also not resolving the issue.
    can any one please tell me if you have any other options to check to resolve this issue.
    Thanks in advance
    Bin

    Hi ,
    Check whether any routines is written which is taking time to be executed.
    Hope it helps.
    Regards,
    Uday shankar.

  • Script is taking long time to execute

    Hi:
    This is the query I am executing, this takes a lot of time, how can I use temp tables to make this work fast:
    There are only about 6000 records but even then taking lot of time
    SET NOCOUNT ON
     DECLARE @SName VARCHAR(40), @ContactNo varchar(11), @Code VARCHAR(20), @EMail VARCHAR(40),@CodeId int
    DECLARE C1 CURSOR
     STATIC FOR SELECT [Staff Name],[Contact No],[Code],[EMail ID] FROM AB
     OPEN C1
      IF @@CURSOR_ROWS > 0
       FETCH NEXT FROM C1 INTO @SName,@ContactNo,@Code,@EMail
       WHILE @@Fetch_status = 0
       BEGIN
        IF EXISTS (SELECT * FROM AddressBook WHERE 
    Name=@SName)
         BEGIN
          UPDATE AddressBook
          SET MobileNo=@ContactNo,
    EMailId=@EMail
          WHERE Name=@SName
         END
        ELSE
         BEGIN
          INSERT INTO AddressBook
          VALUES(@SName,'',@ContactNo,@EMail,'',GETDATE(),GETDATE(),'','A',8,NULL,NULL)
         END
       END
     CLOSE C1
     DEALLOCATE C1
     SET NOCOUNT OFF

    Instead of cursor have you tried to look at MERGE command?
    IF OBJECT_ID('t1') IS NOT NULL
        DROP TABLE t1 
    GO
    CREATE TABLE t1 (id INT PRIMARY KEY, name1 VARCHAR(10))
    INSERT INTO t1
    SELECT 1, 'name 1' UNION ALL
    SELECT 2, 'name 2' UNION ALL
    SELECT 3, 'name 3' UNION ALL
    SELECT 4, 'name 4' UNION ALL
    SELECT 5, 'name 5'
    GO 
    DECLARE @id INT = 6, @name1 VARCHAR(10) = 'name 6'
    MERGE t1
    USING (SELECT @id AS id, @name1 AS name1) AS t2 ON t1.id = t2.id
    WHEN MATCHED
        THEN UPDATE SET t1.name1 = t2.name1
    WHEN NOT MATCHED
        THEN INSERT VALUES(@id, @name1 );
    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

  • The ODS activation is taking long time

    Hi,
    We are on SAP NetWeaver BI 701 (Support Package 5).
    We create a Z ODS, it will contain a lot of data (180.000.000 month-end) and we want to generate specific reports about it.
    The activation is taking long time, I assume is because we checked the flag "SIDs Generation upon Activation". I am confused about this check. I really need it? is this check the only problem.
    Thanks for you help.
    Victoria

    Hi Victoria:
       If your Z DSO is used only for staging purposes (you don't have queries based on this DSO and you send the data to another DSO or to an InfoCube) then you don't need to check the "SIDs Generation Upon Activation" box.
    Even more, to achieve better performance during data loads in this scenario, you might consider using a Write Optimized DSO instead of a Standard DSO, but if you decide to take this alternative don't forget to select the "Do Not check Uniqueness of Data" box if you need to write several records with the same Semantic Key.
    Regards,
    Francisco Milán.

  • Fwrite() and fread() of a shared FAT32 formatted file is taking long time in MAC osx Lion C program

    Hi
    Is there any provision or api in MAC to open a file in shared mode same as windows
       hUSBdrive = CreateFile(pDriveName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
    we have the follwing scenario where a file is shared among two processes for read/write.one is running on Linux and the other one is running on MAC.where both the processses are reading/writing into the same memory location in the file say "X"
    FAT 32 formatted raw data file which is located on the device, is shared among two processes.
    One process is running on Linux device which is connected to MAC book through usb.In this linux process, the file is opened using fopen() and we have used fcntl() with O_DIRECT flag.This process continuously reads/writes data on memory location "X" in the shared file .
    The other process is running on Mac which has simple c program that opens the file on the connected device i.e from usb drive and reads/writes data using fread()/fwrite().fopen() is used to open the file and FILE_NOCACHE flag is used to avoid caching.
    The value at memory location "X" is updated by mac by using fwrite() and the linux process reads the memory location "X" by using fread(). Linux process is taking around 30 sec to get the updated value.
    If the value is updated by Linux process at memory location "X" by using fwrite() the MAC process is also taking long time more than a minute to read the updated value by usng fread().
    fwrite()/fread() on mac is taking long time where as the windows application which uses the same apis is taking msec time.
    Do we need to use other api s or flags to open file?
    thanks in advance.......

    does any one face this kind of problem?
    fwrite() and fread() takes long time?
    Is there any problem in read/write to a fat32 file on MAC?

  • VB Macro in Bex Analyser is taking long time to complete execution

    Hi Experts,
    In a FI query , we have a VB macro which update the excel sheets by taking values from the previous excel sheets .
    The issue is its taking long time for query execution and if we are keep on pressing 'ENTER' button . The query is running very fastly and is giving the results ,but its not a correct way to do.
    Its a critical issue in Production and can anyone help me to resolve the issue.
    Regards,
    Anju

    Hi Anju,
    I need to create a VB macro in one of my query but i not familiar how i can plug the VB code into the query.
    Please can you give me some basic procedure on how to do that?
    What i need to do exactly is to bring a KF from a query into another query. Not sure if this is possible using VB.
    Let me know.
    Thanks.
    Cesar

  • This part of query is taking long time to run, its about 40 minutes. Can anyone help wit it.

    ------Load Dataset into Temp table---------------
    SELECT
    z.SYSTEMNAME
    --,Case when ZXC.[Subsystem Name] <> 'NULL' Then zxc.[SubSystem Name]
    --else NULL
    --End AS SubSystemName
    , CASE
    WHEN z.PROV_TAX_ID IN
    (SELECT DISTINCT zxc.TIN
    FROM dbo.SQS_Provider_Tracking zxc
    WHERE zxc.[SubSystem Name] <> 'NULL'
    THEN
    (SELECT DISTINCT [Subsystem Name]
    FROM dbo.SQS_Provider_Tracking zxc
    WHERE z.PROV_TAX_ID = zxc.TIN)
    End As SubSYSTEMNAME
    ,z.PROVIDERNAME
    ,z.STATECODE
    ,z.PROV_TAX_ID
    ,z.SRC_PAR_CD
    ,SUM(z.SEQUEST_AMT) Actual_Sequestered_Amt
    , CASE
    WHEN z.SRC_PAR_CD IN ('E','O','S','W')
    THEN 'Nonpar Waiver'
    --**Amendment Mailed**
    --WHEN z.PROV_TAX_ID IN
    When EXISTS
    (SELECT DISTINCT b.PROV_TIN
    FROM dbo.SQS_Mailed_TINs_010614 b WITH (NOLOCK )
    where not exists (select * from dbo.sqs_objector_TINs t where b.PROV_TIN = t.prov_tin))
    THEN
    (SELECT DISTINCT b.Mailing
    FROM dbo.SQS_Mailed_TINs_010614 b WITH (NOLOCK )
    WHERE z.PROV_TAX_ID = b.PROV_TIN
    -- --**Amendment Mailed Wave 3 and 4**
    --WHEN z.PROV_TAX_ID In
    When EXISTS
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz WITH (NOLOCK )
    where qz.Mailing = 'Amendment Mailed (3rd Wave)'
    and not exists (select * from dbo.sqs_objector_TINs t WITH (NOLOCK ) where qz.PROV_TIN = t.prov_tin))
    THEN 'Amendment Mailed (3rd Wave)'
    WHEN EXISTS
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz WITH (NOLOCK )
    where qz.Mailing = 'Amendment Mailed (4th Wave)'
    and not exists (select * from dbo.sqs_objector_TINs t WITH (NOLOCK ) where qz.PROV_TIN = t.prov_tin))
    THEN 'Amendment Mailed (4th Wave)'
    -- --Is Puerto Rico of Lifesynch
    WHEN EXISTS
    (SELECT DISTINCT a.PROV_TAX_ID
    FROM PACT.dbo.SQS_NonPar_PR_LS_TINs a WITH (NOLOCK )
    WHERE a.Bucket <> 'Nonpar'
    THEN
    (SELECT DISTINCT a.Bucket
    FROM PACT.dbo.SQS_NonPar_PR_LS_TINs a WITH (NOLOCK )
    WHERE a.PROV_TAX_ID = z.PROV_TAX_ID)
    -- --**Top Objecting Systems**
    WHEN z.SYSTEMNAME IN
    ('ADVENTIST HEALTH SYSTEM','ASCENSION HEALTH ALLIANCE','AULTMAN HEALTH FOUNDATION','BANNER HEALTH SYSTEM','BERT FISH MEDICAL CENTER','BETHESDA MEMORIAL HOSPITAL','BJC HEALTHCARE','BLOUNT MEMORIAL HOSPITAL','BOCA RATON REGIONAL HOSPITAL','CAROMONT HEALTH SYSTEM','CATHOLIC HEALTH INITIATIVES','CATHOLIC HEALTHCARE PARTNERS','CHRISTUS HEALTH',/*'CLEVELAND CLINIC HEALTH SYSTEM',*/'COLUMBUS REGIONAL HEALTHCARE SYSTEM','COMMUNITY HEALTH SYSTEMS, INC','COXHEALTH','HCA','HEALTH MANAGEMENT ASSOCIATES','HUNTSVILLE HOSPITAL HEALTH SYSTEM','INTEGRIS HEALTH','JUPITER MEDICAL CENTER','LEE MEMORIAL HEALTH SYSTEM','MARTIN MEMORIAL HEALTH SYSTEM','MERCY','MT SINAI MEDICAL CENTER (MIAMI)','MUNROE REGIONAL MEDICAL CENTER','NORMAN REGIONAL HEALTH SYSTEM','NORTHSIDE HEALTH SYSTEM','SHANDS HEALTHCARE','SISTERS OF MERCY - SPRINGFIELD, MO','SSM HEALTH CARE','ST LUKES HEALTH SYSTEM','SUMMA HEALTH SYSTEM','SUSQUEHANNA HEALTH SYSTEM','TBD -- TRINITY HEALTH - CATHOLIC HEALTH EAST','UNIVERSITY OF MISSOURI HEALTH SYSTEM','UNIVERSITY OF NEW MEXICO HOSPITALS','UNIVERSITY OF UTAH HEALTH CARE')
    THEN 'Top Objecting Systems'
    WHEN EXISTS
    (SELECT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h
    INNER JOIN SQS_Provider_Tracking obj WITH (NOLOCK )
    ON h.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Top Objector'
    WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
    OR h.SMG_ID IS NOT NULL
    )and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
    THEN 'Top Objecting Systems'
    -- --**Other Objecting Hospitals**
    WHEN EXISTS
    (SELECT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h
    INNER JOIN SQS_Provider_Tracking obj WITH (NOLOCK )
    ON h.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Objector'
    WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
    OR h.SMG_ID IS NOT NULL
    )and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
    THEN 'Other Objecting Hospitals'
    -- --**Objecting Physicians**
    WHEN EXISTS
    (SELECT z.PROV_TAX_ID
    FROM SQS_EDW_Source z WITH (NOLOCK)
    WHERE EXISTS
    (SELECT DISTINCT
    obj.TIN
    FROM SQS_Provider_Tracking obj WITH (NOLOCK )
    WHERE obj.[Objector?] in ('Objector','Top Objector')
    and z.PROV_TAX_ID = obj.TIN
    and z.LCLM_RSTMT_TREND_CAT_CD not IN ('HO','HI')
    THEN 'Objecting Physicians'
    --****Rejecting Hospitals****
    WHEN EXISTS
    (SELECT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h
    INNER JOIN SQS_Provider_Tracking obj WITH (NOLOCK )
    ON h.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Rejector'
    WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
    OR h.SMG_ID IS NOT NULL
    )and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
    THEN 'Rejecting Hospitals'
    --****Rejecting Physciains****
    WHEN EXISTS
    (SELECT obj.TIN
    FROM SQS_Provider_Tracking obj WITH (NOLOCK )
    WHERE z.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Rejector')
    and z.LCLM_RSTMT_TREND_CAT_CD NOT IN ('HO','HI')
    THEN 'REjecting Physicians'
    ----**********ALL OBJECTORS SHOULD HAVE BEEN BUCKETED AT THIS POINT IN THE QUERY**********
    -- --**Non-Objecting Hospitals**
    WHEN EXISTS
    (SELECT DISTINCT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h WITH (NOLOCK )
    WHERE
    (z.PROV_TAX_ID = h.PROV_TAX_ID)
    OR h.SMG_ID IS NOT NULL
    )and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
    THEN 'Non-Objecting Hospitals'
    -- **Outstanding Contracts for Review**
    WHEN EXISTS
    (SELECT qz.PROV_TIN
    FROM
    [PACT].[HUMAD\ARS3766].[SQS_Mailed_TINs] qz WITH (NOLOCK )
    where qz.Mailing = 'Non-Objecting Bilateral Physicians'
    AND z.PROV_TAX_ID = qz.PROV_TIN)
    Then 'Non-Objecting Bilateral Physicians'
    When EXISTS
    (select
    p.prov_tax_id
    from dbo.SQS_CoC_Potential_Mail_List p WITH (NOLOCK )
    where p.amendmentrights <> 'Unilateral'
    AND z.prov_tax_id = p.prov_tax_id)
    THEN 'Non-Objecting Bilateral Physicians'
    WHEN EXISTS
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz WITH (NOLOCK )
    where qz.Mailing = 'More Research Needed'
    AND qz.PROV_TIN = z.PROV_TAX_ID)
    THEN 'More Research Needed'
    WHEN EXISTS (SELECT qz.PROV_TIN FROM [SQS_Mailed_TINs] qz WITH (NOLOCK ) where qz.Mailing = 'Objector' AND qz.PROV_TIN = z.PROV_TAX_ID)
    THEN 'ERROR'
    else 'Market Review/Preparing to Mail'
    END AS [Updated Bucket]
    ,COALESCE(q.INDdesc, f.IND_desc) AS INDdesc
    ,f.Time_Period_for_Dispute
    ,f.Renew_Term_Ind
    ,f.Renewal_Date
    ,z.SMG_ID
    ,'' AS OrderedRank
    INTO SQS_Bucketed_Details_SMG_on_SMGXXX
    From #SQS_EDW_SOURCE_WithSMG z
    left join #F f ON f.PROV_TAX_ID = z.PROV_TAX_ID
    AND z.SYSTEMNAME = f.SYSTEM_NAME
    AND z.PROVIDERNAME = f.Provider
    Left join #Q q ON z.PROV_TAX_ID = q.TIN
    GROUP BY z.SYSTEMNAME
    --,Z.[SubsystemName]
    ,z.PROVIDERNAME
    ,z.STATECODE
    ,z.PROV_TAX_ID
    ,z.SRC_PAR_CD
    ,q.INDdesc
    ,f.IND_Desc
    ,f.Time_Period_for_Dispute
    ,f.Renew_Term_Ind
    ,f.Renewal_Date
    ,z.SMG_ID
    ,z.LCLM_RSTMT_TREND_CAT_CD
    As I am a developer I do not have the access to Sql profiler or tuning agent to optimize my query, I have used some joins over the temp table #HIHO which indeed pulling the records from table EDW_Source which has 5 million records, I also added Non clustered
    indexes on prov_ID, SMG_ID and Incurred month for this table, but still it is taking longer time. Need help

    Hi, It needs some more tweaks but pls try this one
    USE
    Go
    --****Create sqs_objector_TINs (Objections and Rejections)****
    --Drop table .dbo.sqs_objector_TINs
    select distinct a.TIN as Prov_TIN
    Into #sqs_objector_TINs
    from .dbo.sqs_provider_tracking as a with (nolock)
    where a.[Objector?] in ('Top Objector','Objector','Rejector')
    /*********** Query for SQS_TINtoSyst***********/
    --DROP TABLE .dbo.SQS_TINtoSystem
    select distinct
    b.SRC_PROV_ID
    --,case
    -- when a.SYSTEM_NAME is null
    -- then
    -- case
    -- when a.CTRCT_GRP_NAME is null
    -- then a.PROV_SMG_NAME
    -- else a.CTRCT_GRP_NAME
    -- end
    -- else a.SYSTEM_NAME
    --end as SYSTEM_NAME
    ,COALESCE(a.SYSTEM_NAME, a.CTRCT_GRP_NAME, a.PROV_SMG_NAME) AS SYSTEM_NAME
    INTO #SQS_TINtoSystem
    from
    PARE.dbo.EDW_PROD_HOSPITAL_MASTER a with (nolock)
    Inner Join PARE.dbo.EDW_PROD_HOSPITAL_ID_XREF b with (nolock)
    on a.SMG_ID = b.SMG_ID
    -- Inner Join .dbo.SQS_EDW_Source q
    --on b.SRC_PROV_ID = q.PROV_TAX_ID
    where b.SRC_PLATFORM_CD = 'TX'
    and exists
    select
    SMG_ID
    from PARE.dbo.EDW_PROD_HOSPITAL_ID_XREF as t1 with (nolock)
    where SRC_PLATFORM_CD = 'TX'
    and exists (select q.PROV_TAX_ID from .dbo.SQS_EDW_Source q with (nolock) where q.PROV_TAX_ID = b.SRC_PROV_ID)
    and a.SMG_ID = t1.SMG_ID
    /************** Query for SQS_Bucketed_Details_SMG*****************/
    DROP TABLE .dbo.SQS_Bucketed_Details_SMG
    --Create temp table
    SELECT z.SYSTEMNAME
    ,Z.PROV_TAX_ID
    ,z.PROVIDERNAME
    ,z.STATECODE
    ,z.SRC_PAR_CD
    ,z.SEQUEST_AMT
    ,case when Z.LCLM_RSTMT_TREND_CAT_CD IN ('HI','HO') Then 'H' else 'P' end as Hosp_Ind
    ,Z.SMG_ID
    INTO #SQS_EDW_SOURCE_WithSMG
    FROM dbo.SQS_EDW_SOURCE_WithSMG z with (nolock)
    WHERE (Z.Incurred_Mth >= convert(datetime,'01/01/2013')) and (Z.Incurred_Mth < convert(datetime, '1/1/2014'))
    --between convert(datetime,'01/01/2013') and convert(datetime, '12/31/2013 23:59:59.996')
    --YEAR(Z.Incurred_Mth)=2013
    -- Create Temp table Q
    select
    x.TIN,
    case when max(x.IND) = 'NYN'
    then 'Standard'
    when max(x.IND) = 'YNN'
    then 'Express'
    when max(x.IND) = 'NNY'
    then 'Non_Standard' else 'Mixed'
    end as INDdesc
    Into #Q
    FROM
    (SELECT
    a.tin,
    MAX(a.express) + MAX(a.StandardInd) + MAX(NonstandardIND) as IND
    from
    (select r.TIN,
    case when MAX(r.Express) like 'Y%' then 'Y' else 'N' end As Express,
    case when MAX(r.Standard) = 'Y' then 'Y' else 'N' end As StandardInd,
    case when MAX(r.[Non-Standard]) = 'Y' then 'Y' else 'N' end AS NonstandardIND
    FROM DBO.SQS_Objectors_01032014 r with (nolock)
    GROUP BY r.TIN) a
    group by a.TIN) x
    group by x.TIN
    --Create Temp table F
    Select *
    INTO #F
    FROM(
    SELECT distinct g.prov_tax_id
    ,g.system_name
    ,g.provider
    ,case when g.reimburse_mixed = 'Y' then 'Mixed'
    when g.reimburse_express = 'Y' then 'Express'
    when g.reimburse_standard = 'Y' then 'Standard'
    when g.reimburse_NonStandard = 'Y' then 'NonStandard'
    end as IND_Desc
    ,g.Time_Period_for_Dispute
    ,case when g.Renewal_Date = 'N' and g.Expiration_Date = 'N'
    then 'Unclear'
    when g.Renewal_Date = 'N' and g.Expiration_Date <> 'N'
    then 'Termination'
    when g.Renewal_Date <> 'N' and g.Expiration_Date = 'N'
    then 'Evergreen'
    when g.Renewal_Date <> 'N' and g.Expiration_Date <> 'N'
    then 'Termination'
    else 'Unknown'
    end as 'Renew_Term_Ind'
    ,g.Renewal_Date
    FROM
    (select distinct
    bb.PROV_TAX_ID1 as prov_tax_id
    ,aa.*
    from
    [dbo].[Top_600_Hospitals3] aa with (nolock)
    left join pare.dbo.EDW_PROD_HOSPITAL_MASTER bb with (nolock)
    on --a.CTRCT_GRP_NAME = b.CTRCT_GRP_NAME
    aa.Provider = bb.PROV_SMG_NAME
    -- and (a.SYSTEM_NAME = b.SMG_SYS_NAME or a.SYSTEM_NAME = b.SYSTEM_NAME)
    --and a.ADDR_LINE1 = b.ADDR_LINE1
    and aa.STATE_CD = bb.STATE_CD
    --and a.ZIP_CD = b.ZIP_CD
    and aa.City1 = bb.CITY_NAME
    where aa.SYSTEM_NAME <> 'SEE ABOVE') g
    where g.system_name <> 'SEE ABOVE') h
    where h.ind_Desc is not null
    SELECT DISTINCT z.PROV_TAX_ID
    , z.SMG_ID
    INTO #HIHO_Records
    FROM SQS_EDW_SOURCE_WithSMG z with (nolock)
    WHERE z.LCLM_RSTMT_TREND_CAT_CD IN ('HO', 'HI')
    AND Z.Incurred_Mth >=convert(datetime, '1/1/2013') and Z.Incurred_Mth <convert(datetime, '1/1/2014')
    --YEAR(Z.Incurred_Mth)=2013
    ---------------------------------Load Dataset into Temp table---------------
    SELECT
    z.SYSTEMNAME
    --,Case when ZXC.[Subsystem Name] <> 'NULL' Then zxc.[SubSystem Name]
    --else NULL
    --End AS SubSystemName
    , CASE
    WHEN z.PROV_TAX_ID IN
    (SELECT zxc.TIN
    FROM dbo.SQS_Provider_Tracking zxc with (nolock)
    WHERE zxc.[SubSystem Name] <> 'NULL'
    THEN
    (SELECT top 1 [Subsystem Name]
    FROM dbo.SQS_Provider_Tracking zxc with (nolock)
    WHERE z.PROV_TAX_ID = zxc.TIN)
    End As SubSYSTEMNAME
    ,z.PROVIDERNAME
    ,z.STATECODE
    ,z.PROV_TAX_ID
    ,z.SRC_PAR_CD
    ,SUM(z.SEQUEST_AMT) Actual_Sequestered_Amt
    , CASE
    WHEN z.SRC_PAR_CD IN ('E','O','S','W')
    THEN 'Nonpar Waiver'
    -- --Is Puerto Rico of Lifesynch
    WHEN z.PROV_TAX_ID IN
    (SELECT a.PROV_TAX_ID
    FROM .dbo.SQS_NonPar_PR_LS_TINs a with (nolock)
    WHERE a.Bucket <> 'Nonpar'
    THEN
    (SELECT top 1 a.Bucket
    FROM .dbo.SQS_NonPar_PR_LS_TINs a with (nolock)
    WHERE a.PROV_TAX_ID = z.PROV_TAX_ID)
    --**Amendment Mailed**
    WHEN z.PROV_TAX_ID IN
    (SELECT b.PROV_TIN
    FROM dbo.SQS_Mailed_TINs_010614 b WITH (NOLOCK )
    where not exists (select * from dbo.sqs_objector_TINs t with (nolock) where b.PROV_TIN = t.prov_tin))
    and z.Hosp_Ind = 'P'
    THEN
    (SELECT top 1 b.Mailing
    FROM dbo.SQS_Mailed_TINs_010614 b with (nolock)
    WHERE z.PROV_TAX_ID = b.PROV_TIN
    -- --**Amendment Mailed Wave 3-5**
    WHEN z.PROV_TAX_ID In
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz
    where qz.Mailing = 'Amendment Mailed (3rd Wave)'
    and not exists (select * from dbo.sqs_objector_TINs t with (nolock) where qz.PROV_TIN = t.prov_tin))
    and z.Hosp_Ind = 'P'
    THEN 'Amendment Mailed (3rd Wave)'
    WHEN z.PROV_TAX_ID IN
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz
    where qz.Mailing = 'Amendment Mailed (4th Wave)'
    and not exists (select * from dbo.sqs_objector_TINs t with (nolock) where qz.PROV_TIN = t.prov_tin))
    and z.Hosp_Ind = 'P'
    THEN 'Amendment Mailed (4th Wave)'
    WHEN z.PROV_TAX_ID IN
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz
    where qz.Mailing = 'Amendment Mailed (5th Wave)'
    and not exists (select * from dbo.sqs_objector_TINs t with (nolock) where qz.PROV_TIN = t.prov_tin))
    and z.Hosp_Ind = 'P'
    THEN 'Amendment Mailed (5th Wave)'
    -- --**Top Objecting Systems**
    WHEN z.SYSTEMNAME IN
    ('ADVENTIST HEALTH SYSTEM','ASCENSION HEALTH ALLIANCE','AULTMAN HEALTH FOUNDATION')
    THEN 'Top Objecting Systems'
    WHEN z.PROV_TAX_ID IN
    (SELECT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h
    INNER JOIN .dbo.SQS_Provider_Tracking obj with (nolock)
    ON h.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Top Objector'
    WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
    OR h.SMG_ID IS NOT NULL
    )and z.Hosp_Ind = 'H'
    THEN 'Top Objecting Systems'
    -- --**Other Objecting Hospitals**
    WHEN (z.PROV_TAX_ID IN
    (SELECT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h
    INNER JOIN .dbo.SQS_Provider_Tracking obj with (nolock)
    ON h.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Objector'
    WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
    OR h.SMG_ID IS NOT NULL
    )and z.Hosp_Ind = 'H')
    THEN 'Other Objecting Hospitals'
    -- --**Objecting Physicians**
    WHEN (z.PROV_TAX_ID IN
    (SELECT
    obj.TIN
    FROM .dbo.SQS_Provider_Tracking obj with (nolock)
    WHERE obj.[Objector?] in ('Objector','Top Objector')
    and z.PROV_TAX_ID = obj.TIN
    and z.Hosp_Ind = 'P')
    THEN 'Objecting Physicians'
    --****Rejecting Hospitals****
    WHEN (z.PROV_TAX_ID IN
    (SELECT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h
    INNER JOIN .dbo.SQS_Provider_Tracking obj with (nolock)
    ON h.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Rejector'
    WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
    OR h.SMG_ID IS NOT NULL
    )and z.Hosp_Ind = 'H')
    THEN 'Rejecting Hospitals'
    --****Rejecting Physciains****
    WHEN
    (z.PROV_TAX_ID IN
    (SELECT
    obj.TIN
    FROM .dbo.SQS_Provider_Tracking obj with (nolock)
    WHERE z.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Rejector')
    and z.Hosp_Ind = 'P')
    THEN 'REjecting Physicians'
    ----**********ALL OBJECTORS SHOULD HAVE BEEN BUCKETED AT THIS POINT IN THE QUERY**********
    -- --**Non-Objecting Hospitals**
    WHEN z.PROV_TAX_ID IN
    (SELECT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h
    WHERE
    (z.PROV_TAX_ID = h.PROV_TAX_ID)
    OR h.SMG_ID IS NOT NULL)
    and z.Hosp_Ind = 'H'
    THEN 'Non-Objecting Hospitals'
    -- **Outstanding Contracts for Review**
    WHEN z.PROV_TAX_ID IN
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz with (nolock)
    where qz.Mailing = 'Non-Objecting Bilateral Physicians'
    AND z.PROV_TAX_ID = qz.PROV_TIN)
    Then 'Non-Objecting Bilateral Physicians'
    When z.prov_tax_id in
    (select
    p.prov_tax_id
    from dbo.SQS_CoC_Potential_Mail_List p with (nolock)
    where p.amendmentrights <> 'Unilateral'
    AND z.prov_tax_id = p.prov_tax_id)
    THEN 'Non-Objecting Bilateral Physicians'
    WHEN z.PROV_TAX_ID IN
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz
    where qz.Mailing = 'More Research Needed'
    AND qz.PROV_TIN = z.PROV_TAX_ID)
    THEN 'More Research Needed'
    WHEN z.PROV_TAX_ID IN (SELECT qz.PROV_TIN FROM [SQS_Mailed_TINs] qz with (nolock) where qz.Mailing = 'Objector' AND qz.PROV_TIN = z.PROV_TAX_ID)
    THEN 'ERROR'
    else 'Market Review/Preparing to Mail'
    END AS [Updated Bucket]
    ,COALESCE(q.INDdesc, f.IND_desc) AS INDdesc
    ,f.Time_Period_for_Dispute
    ,f.Renew_Term_Ind
    ,f.Renewal_Date
    ,z.SMG_ID
    ,'' AS OrderedRank
    INTO dbo.SQS_Bucketed_Details_SMG with (nolock)
    From #SQS_EDW_SOURCE_WithSMG z
    left join #F f ON f.PROV_TAX_ID = z.PROV_TAX_ID
    AND z.SYSTEMNAME = f.SYSTEM_NAME
    AND z.PROVIDERNAME = f.Provider
    Left join #Q q ON z.PROV_TAX_ID = q.TIN
    GROUP BY z.SYSTEMNAME
    --,Z.[SubsystemName]
    ,z.PROVIDERNAME
    ,z.STATECODE
    ,z.PROV_TAX_ID
    ,z.SRC_PAR_CD
    ,q.INDdesc
    ,f.IND_Desc
    ,f.Time_Period_for_Dispute
    ,f.Renew_Term_Ind
    ,f.Renewal_Date
    ,z.SMG_ID
    ,z.Hosp_Ind
    /************************** Drop temp tables*********************/
    --DROP TABLE #SQS_EDW_SOURCE_WithSMG
    --DROP TABLE #Q
    --DROP TABLE #F
    --DROP TABLE #HIHO_Records
    --DROP TABLE #SQS_TINtoSystem
    --DROP TABLE #SQS_EDW_SOURCE_WithSMG
    --DROP TABLE #sqs_objector_TINs

  • Taking long time to execute views

    Hi All,
    my query is taking long time to execute(i am using standard views in my query)
    XLA_INV_AEL_GL_V , XLA_WIP_AEL_GL_V -----these standard views itself taking long time to execute ,but i need the info from this views
    WHERE gjh.je_batch_id = gjb.je_batch_id AND
    gjh.je_header_id = gjl.je_header_id AND
    gjh.je_header_id = xlawip.je_header_id AND
    gjl.je_header_id = xlawip.je_header_id AND
    gjl.je_line_num = xlawip.je_line_num AND
    gcc.code_combination_id = gjl.code_combination_id AND
    gjl.code_combination_id = xlawip.code_combination_id AND
    gjb.set_of_books_id = xlawip.set_of_books_id AND
    gjh.je_source = 'Inventory' AND
    gjh.je_category = 'WIP' AND
    gp.period_set_name = 'Accounting' AND
    gp.period_name = gjl.period_name AND
    gp.period_name = gjh.period_name AND
    gp.start_date +1 between to_date(startdate,'DD-MON-YY') AND
    to_date(enddate,'DD-MON-YY') AND
    gjh.status =nvl(lstatus,gjh.status)
    Could any one help me to execute it fast?
    Thanks
    Madhu

    [url http://forums.oracle.com/forums/thread.jspa?threadID=501834&tstart=0]When your query takes too long...

  • Crystal reports for Eclipse (CR4E)  - taking long time to load

    HI
    We have used your Crystal reports for Eclipse (CR4E) but it is taking long time to load if the record count is more than 3 million
    Our architecture is we are using Oracle DB and web sphere application server both are running on SUN server,
    If we buy original version it will work fast?
    Or do you  have alternative solution for this, this one to implement one of our major client

    You have 3 million records, this is going to take time to process.  Also, you don't define what is meant by a long time.  Are we talking a couple of minutes, or something more like 20 minutes? 
    The real question is, do you really need the report to bring back 3 million records?  Could you do any filtering of the data to reduce the number of records being brought back?  Also, 3 million records could vary.  is each record a single field, or is it multiple.   The more fields, the larger the result set.
    Another thing you want to look at, is just how long is the query taking to run against the database.

  • 11.5.10.2 -12.1.1 Upgrade- American English patch driver taking long time

    Hi,
    I have performed test upgrade from 11.5.10.2 to 12.1.1.It was successful.
    The American English Upgrade patch driver had taken 20 hours time to complete.
    Now i am doing a second test run by following the same steps, but now the same patch is taking long time. It is running from past 24 hours.
    And still 54000 jobs to complete.
    The main difference between my two test runs is
    1.For first instance both database and apps are in one server. (single node)
    2.For this new test instance, we have database running one server and 12.1.1 file system on another server.
    Will it make any difference? How can i diagnose the issue?
    The patch log is not showing any errors, but taking long time to complete.
    Thanks,

    Hi,
    From m note 12.1.1 UPGRADE FROM 11.5.10.2 VERY SLOW XDOLOADER TASK HANGS [ID 1065393.1],
    after changing mv /dev/random /dev/random_bak
    ln -s /dev/urandom /dev/random
    do i need to reboot the server?
    After this can i continue the previous session of the patch? or start new session?
    Thanks,

  • Query taking long time for EXTRACTING the data more than 24 hours

    Hi ,
    Query taking long time for EXTRACTING the data more than 24 hours please find the query and explain plan details below even indexes avilable on table's goe's to FULL TABLE SCAN. please suggest me.......
    SQL> explain plan for select a.account_id,round(a.account_balance,2) account_balance,
    2 nvl(ah.invoice_id,ah.adjustment_id) transaction_id,
    to_char(ah.effective_start_date,'DD-MON-YYYY') transaction_date,
    to_char(nvl(i.payment_due_date,
    to_date('30-12-9999','dd-mm-yyyy')),'DD-MON-YYYY')
    due_date, ah.current_balance-ah.previous_balance amount,
    decode(ah.invoice_id,null,'A','I') transaction_type
    3 4 5 6 7 8 from account a,account_history ah,invoice i_+
    where a.account_id=ah.account_id
    and a.account_type_id=1000002
    and round(a.account_balance,2) > 0
    and (ah.invoice_id is not null or ah.adjustment_id is not null)
    and ah.CURRENT_BALANCE > ah.previous_balance
    and ah.invoice_id=i.invoice_id(+)
    AND a.account_balance > 0
    order by a.account_id,ah.effective_start_date desc; 9 10 11 12 13 14 15 16
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 544K| 30M| | 693K (20)|
    | 1 | SORT ORDER BY | | 544K| 30M| 75M| 693K (20)|
    |* 2 | HASH JOIN | | 544K| 30M| | 689K (20)|
    |* 3 | TABLE ACCESS FULL | ACCOUNT | 20080 | 294K| | 6220 (18)|
    |* 4 | HASH JOIN OUTER | | 131M| 5532M| 5155M| 678K (20)|
    |* 5 | TABLE ACCESS FULL| ACCOUNT_HISTORY | 131M| 3646M| | 197K (25)|
    | 6 | TABLE ACCESS FULL| INVOICE | 262M| 3758M| | 306K (18)|
    Predicate Information (identified by operation id):
    2 - access("A"."ACCOUNT_ID"="AH"."ACCOUNT_ID")
    3 - filter("A"."ACCOUNT_TYPE_ID"=1000002 AND "A"."ACCOUNT_BALANCE">0 AND
    ROUND("A"."ACCOUNT_BALANCE",2)>0)
    4 - access("AH"."INVOICE_ID"="I"."INVOICE_ID"(+))
    5 - filter("AH"."CURRENT_BALANCE">"AH"."PREVIOUS_BALANCE" AND ("AH"."INVOICE_ID"
    IS NOT NULL OR "AH"."ADJUSTMENT_ID" IS NOT NULL))
    22 rows selected.
    Index Details:+_
    SQL> select INDEX_OWNER,INDEX_NAME,COLUMN_NAME,TABLE_NAME from dba_ind_columns where
    2 table_name in ('INVOICE','ACCOUNT','ACCOUNT_HISTORY') order by 4;
    INDEX_OWNER INDEX_NAME COLUMN_NAME TABLE_NAME
    OPS$SVM_SRV4 P_ACCOUNT ACCOUNT_ID ACCOUNT
    OPS$SVM_SRV4 U_ACCOUNT_NAME ACCOUNT_NAME ACCOUNT
    OPS$SVM_SRV4 U_ACCOUNT CUSTOMER_NODE_ID ACCOUNT
    OPS$SVM_SRV4 U_ACCOUNT ACCOUNT_TYPE_ID ACCOUNT
    OPS$SVM_SRV4 I_ACCOUNT_ACCOUNT_TYPE ACCOUNT_TYPE_ID ACCOUNT
    OPS$SVM_SRV4 I_ACCOUNT_INVOICE INVOICE_ID ACCOUNT
    OPS$SVM_SRV4 I_ACCOUNT_PREVIOUS_INVOICE PREVIOUS_INVOICE_ID ACCOUNT
    OPS$SVM_SRV4 U_ACCOUNT_NAME_ID ACCOUNT_NAME ACCOUNT
    OPS$SVM_SRV4 U_ACCOUNT_NAME_ID ACCOUNT_ID ACCOUNT
    OPS$SVM_SRV4 I_LAST_MODIFIED_ACCOUNT LAST_MODIFIED ACCOUNT
    OPS$SVM_SRV4 I_ACCOUNT_INVOICE_ACCOUNT INVOICE_ACCOUNT_ID ACCOUNT
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ACCOUNT ACCOUNT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ACCOUNT SEQNR ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_INVOICE INVOICE_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ADINV INVOICE_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA CURRENT_BALANCE ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA INVOICE_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA ADJUSTMENT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA ACCOUNT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_LMOD LAST_MODIFIED ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ADINV ADJUSTMENT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_PAYMENT PAYMENT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ADJUSTMENT ADJUSTMENT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_APPLIED_DT APPLIED_DATE ACCOUNT_HISTORY
    OPS$SVM_SRV4 P_INVOICE INVOICE_ID INVOICE
    OPS$SVM_SRV4 U_INVOICE CUSTOMER_INVOICE_STR INVOICE
    OPS$SVM_SRV4 I_LAST_MODIFIED_INVOICE LAST_MODIFIED INVOICE
    OPS$SVM_SRV4 U_INVOICE_ACCOUNT ACCOUNT_ID INVOICE
    OPS$SVM_SRV4 U_INVOICE_ACCOUNT BILL_RUN_ID INVOICE
    OPS$SVM_SRV4 I_INVOICE_BILL_RUN BILL_RUN_ID INVOICE
    OPS$SVM_SRV4 I_INVOICE_INVOICE_TYPE INVOICE_TYPE_ID INVOICE
    OPS$SVM_SRV4 I_INVOICE_CUSTOMER_NODE CUSTOMER_NODE_ID INVOICE
    32 rows selected.
    Regards,
    Bathula
    Oracle-DBA

    I have some suggestions. But first, you realize that you have some redundant indexes, right? You have an index on account(account_name) and also account(account_name, account_id), and also account_history(invoice_id) and account_history(invoice_id, adjustment_id). No matter, I will suggest some new composite indexes.
    Also, you do not need two lines for these conditions:
    and round(a.account_balance, 2) > 0
    AND a.account_balance > 0
    You can just use: and a.account_balance >= 0.005
    So the formatted query isselect a.account_id,
           round(a.account_balance, 2) account_balance,
           nvl(ah.invoice_id, ah.adjustment_id) transaction_id,
           to_char(ah.effective_start_date, 'DD-MON-YYYY') transaction_date,
           to_char(nvl(i.payment_due_date, to_date('30-12-9999', 'dd-mm-yyyy')),
                   'DD-MON-YYYY') due_date,
           ah.current_balance - ah.previous_balance amount,
           decode(ah.invoice_id, null, 'A', 'I') transaction_type
      from account a, account_history ah, invoice i
    where a.account_id = ah.account_id
       and a.account_type_id = 1000002
       and (ah.invoice_id is not null or ah.adjustment_id is not null)
       and ah.CURRENT_BALANCE > ah.previous_balance
       and ah.invoice_id = i.invoice_id(+)
       AND a.account_balance >= .005
    order by a.account_id, ah.effective_start_date desc;You will probably want to select:
    1. From ACCOUNT first (your smaller table), for which you supply a literal on account_type_id. That should limit the accounts retrieved from ACCOUNT_HISTORY
    2. From ACCOUNT_HISTORY. We want to limit the records as much as possible on this table because of the outer join.
    3. INVOICE we want to access last because it seems to be least restricted, it is the biggest, and it has the outer join condition so it will manufacture rows to match as many rows as come back from account_history.
    Try the query above after creating the following composite indexes. The order of the columns is important:create index account_composite_i on account(account_type_id, account_balance, account_id);
    create index acct_history_comp_i on account_history(account_id, invoice_id, adjustment_id, current_balance, previous_balance, effective_start_date);
    create index invoice_composite_i on invoice(invoice_id, payment_due_date);All the columns used in the where clause will be indexed, in a logical order suited to the needs of the query. Plus each selected column is indexed as well so that we should not need to touch the tables at all to satisfy the query.
    Try the query after creating these indexes.
    A final suggestion is to try larger sort and hash area sizes and a manual workarea policy.alter session set workarea_size_policy = manual;
    alter session set sort_area_size = 2147483647;
    alter session set hash_area_size = 2147483647;

  • CDHDR table query taking long time

    Hi all,
    Select query from CDHDR table is taking long time,in where condition i am giving OBJECTCLASS = 'MAT_FULL' udate = sy-datum and langu = 'EN'.
    any suggestion to improve the performance.i want to select all the article which got changed on current date
    regards
    shibu

    This will always be slow for large data volumes, since CDHDR is designed for quick access by object ID (in this case material number), not by date.
    I'm afraid you would need to introduce a secondary index on OBJECTCLAS and UDATE, if that query is crucial enough to warrant the additional disk space and processing time taken by the new index.
    Greetings
    Thomas

  • Nested joins taking long time

    Hi Experts,
    Select query is taking long time execution.
    *- Get the Goods receipts  mainly selected per period (=> MKPF secondary
      SELECT mseg~ebeln mseg~ebelp mseg~werks
             ekko~bukrs ekko~lifnr ekko~zterm ekko~ekorg ekko~ekgrp
             ekko~inco1 ekko~exnum
             lfa1~name1 lfa1~land1 lfa1~ktokk lfa1~stceg
             mkpf~mblnr mkpf~mjahr mseg~zeile mkpf~bldat mkpf~budat
             mseg~bwart
    *Start of changes for CIP 6203752 by PGOX02
             mseg~smbln
    *End of changes for CIP 6203752 by PGOX02
             ekpo~matnr ekpo~txz01 ekpo~menge ekpo~meins
             ekbe~menge ekbe~dmbtr ekbe~wrbtr ekbe~waers
             ekpo~lgort ekpo~matkl ekpo~webaz ekpo~konnr ekpo~ktpnr
             ekpo~plifz ekpo~bstae
             INTO corresponding fields of TABLE it_temp
    *--Begin of modification
    *    FROM mkpf JOIN mseg ON mseg~mblnr EQ mkpf~mblnr
         FROM mkpf INNER JOIN mseg ON mseg~mandt EQ mkpf~mandt
                           and  mseg~mblnr EQ mkpf~mblnr
    *--End of modification
                           AND mseg~mjahr EQ mkpf~mjahr
                  JOIN ekbe ON ekbe~ebeln EQ mseg~ebeln
                           AND ekbe~ebelp EQ mseg~ebelp
                           AND ekbe~zekkn EQ '00'
                           AND ekbe~vgabe EQ '1'
                           AND ekbe~gjahr EQ mseg~mjahr
                           AND ekbe~belnr EQ mseg~mblnr
                           AND ekbe~buzei EQ mseg~zeile
                  JOIN ekpo ON ekpo~ebeln EQ ekbe~ebeln
                           AND ekpo~ebelp EQ ekbe~ebelp
                  JOIN ekko ON ekko~ebeln EQ ekpo~ebeln
                  JOIN lfa1 ON lfa1~lifnr EQ ekko~lifnr
              WHERE mkpf~budat IN so_budat
          AND mkpf~bldat IN so_bldat
          AND mkpf~vgart EQ 'WE'
          AND mseg~bwart IN so_bwart
          AND mseg~matnr IN so_matnr
          AND mseg~werks IN so_werks
          AND mseg~lifnr IN so_lifnr
          AND mseg~ebeln IN so_ebeln
          AND ekko~ekgrp IN so_ekgrp
          AND ekko~bukrs IN so_bukrs
          AND ekpo~matkl IN so_matkl
          AND ekko~bstyp IN so_bstyp
          AND ekpo~loekz EQ space
          AND ekpo~plifz IN so_plifz.
    in st05 it is showing MKPF is taking more time. Need ur sugesstions need ur help
    Moderator message - Please use code tags to format your code
    Edited by: Rob Burbank on Feb 5, 2010 9:21 AM

    Hi,
    your result set is quite big.
    20296 records in 283,5 seconds (13,9 ms per record) might not be optimal
    but definatelly the big result set will take time to execute, since you are reading data from 6 tables:
    SELECT
    FROM mkpf
    JOIN mseg ON u2026
    JOIN ekbe ON u2026
    JOIN ekpo ON u2026
    JOIN ekko ON u2026
    JOIN lfa1 ON u2026
    what run time do you expect?
    In case we would be able to get one record in 5ms it will still run more than 100 seconds.
    Generally: Limit the result set as far as possible (with where conditions), select only the columns that are really needed.
    Geneal nested loop join optimization:
    check if the optimizer chooses the table that has the smallest result set (take all where conditions for each table
    and use SE16 to count the result sets, the smallest one should be the start for the nested loop join.
    For the starting table the selective where condition fields (those the limit the result set significantly for that table) should be indexed.
    For other tables the join condition (and maybe additional selecitve where conditions for this table) should be indexed. but most likely you will join to the tables using the primary key which is indexed... .
    Kind regards,
    Hermann

  • Sql code taking long time

    Hello Everyone,
    In Oracle 10g,I have table emp_history and column name hired_date,which has the
    values in the following format 7/8/2011 12:55:55 PM
    ('mm/dd/yyyy hh12:mi:ss AM') ana this table has more than 50 thousand records,
    when I tried to get the employees whose hired_date between 01/04/2011 and 30/04/2011
    its taking long time(16 to 19 minutes) just to fetch 845 records.
    I tried the following codes,
    select * from emp_history where to_char(hired_date,'mmddyyyy') between
    04012011' and 04302011' and ...;and
      select * from emp_history where to_char(hired_date,'ddmmyyyy') between
    '01042011' and 30042011' and ....It having some other where condition also but If I commented the above where condition alone its working fine,
    If I include i taking long time.
    Can anyone tell me how to modify the code.
    Thank you.
    Edited by: Gurujothi on Aug 3, 2012 4:21 AM

    Do you have an index on HIRED_DATE column? If yes then your index will not be considered.
    You need to write your query like this.
    select *
      from emp_history
    where hired_date between to_date('04012011', 'mmddyyyy') and (to_date('04302011', 'mmddyyyy') + 1) - interval '1' second
       and ...;Use of function on a column makes that column index unusable.
    Further to assist you please read the following link and post the required details
    {message:id=9360003}

Maybe you are looking for

  • Oracle 9i 32 bit ON Windows 2003 server 32 bit

    Hi all I have oracle 9i 32 bit istalled on HP server with windows 2003 server 32 bit, 8GB ram. I am trying to increase oracle memory size (SGA + PGA), but when I exceed 2GB for (SGA + PGA) it gives me error (ORA-27102 : out of memory) Is it because t

  • ITunes recognizes new iPhone 5 as old iPhone 4s

    I had several problems 4 days into my life with my new iphone 5. Flashing screen, exiting out of apps, not downloading apps... and I was driving 1400 miles in a rental with no navigation. On top of that... my iTunes program was only recognizing it as

  • Paging in PDF previews

    The SWF preview of multi-page PDFs isn't behaving as I would expect for simple online viewing. Specifically, if you launch a preview of a multi-page PDF doc, and scroll down to the bottom of the page, all is as expected. You can't (as you would in Re

  • Can't open .fff files in Lightroom 3.5 candidate, though update states compatibility??

    Hi, I just installed the 3.5 Lightroom Candidate, and am trying to import my .fff Hasselblad files.  The documentation states .fff files are supported, but cannot seem to import files.  Files are initially recognized but see the following attachement

  • FD32 restrict users based on a schedule of authority

    All, I have a requirement within FD32 to restrict users based on a schedule of authority.  For example, only allowing credit limits to be changed in a user's authorized dollar range.  I was able to restrict the Credit Limit field (change/display) by