Query taking lot of time to execute..

Hi,
I have a very complecated query which I am executing using JDBC. The query has an insert statement. This query takes 15 mins to complete. I'm running the query as stand alone java program. Can some one have some suggestions what is the best way to debug. I need to find out why the query is taking that long. I'm using oracle 10g with sql developer.
ps = con.prepareStatement(query);
ps.setString(1,date);
ps.setString(2,code);
timeStart = System.currentTimeMillis();
ps.executeUpdate();
timeEnd = System.currentTimeMillis();     
System.out.println("Time Taken::"+(timeStart -timeEnd)+" ms");
Thanks in advance
Ajoo

Perhaps you should post the query so we can see what you are doing.
In the mean time, try writing a simple update query and run it. If it runs quickly, your original query has problems. If it runs slow, its caused by something other than your original query.
P.S.:
should be:
System.out.println("Time Taken::"(timeEnd -timeStart)" ms");
and not this:
System.out.println("Time Taken::"(timeStart -timeEnd)" ms");
Edited by: njbt7y on Jan 19, 2011 12:07 PM

Similar Messages

  • Query takes lots of time to execute how to minizie

    Hi ALL,
    I have a query like this which takes atleat 3 mins to execute how to optimiized the code from the below query
    how to minimize the time
    SELECT
    PRO.PROJECT_NAME "Project Name",
    POBJ.NAME "Object Name",
    X."Major" "Internal_Major",
    X."Minor" "Internal_Minor",
    X."Normalized" "Internal_Normalized",
    TRUNC(X."IDR",2) "Internal Defect Rate",
    Y."Major" "External_Major",
    Y."Minor" "External_Minor",
    Y."Normalized" "External_Normalized",
    TRUNC(Y."EDR",2) "External_Defect_Rate",
    PRO.ID "PRO_ID",
    POBJ.ID "POBJ_ID"
    FROM
    PROJECTS PRO, PROJECT_OBJECTS POBJ,
    (SELECT
    MN."PRO_ID",
    MN."POBJ_ID",
    MN."Major",
    MN."Minor",
    MN."Normalized",
    DR."IDR_PRO_ID",
    DR."IDR_POBJ_ID",
    DR."IDR"
    FROM IDR_TEST DR FULL OUTER JOIN MAJOR_MINOR_NORMALIZED MN
    ON
    MN."PRO_ID" = DR."IDR_PRO_ID" AND
    MN."POBJ_ID" = DR."IDR_POBJ_ID") X,
    (SELECT
    EE."PRO_ID" E_PRO_ID,
    EN."PRO_ID" EN_PRO_ID,
    EE."POBJ_ID" E_POBJ_ID,
    EN."POBJ_ID" EN_POBJ_ID,
    EN."Major",
    EN."Minor",
    EN."Normalized",
    EN."Normalized" / DECODE(EE."External_Effort",0,NULL,EE."External_Effort") "EDR"
    FROM
    EXTR_MAJOR_MINOR_NORMALIZED EN FULL OUTER JOIN EXTERNAL_EFFORT EE
    ON
    EE."PRO_ID" = EN."PRO_ID" AND
    EE."POBJ_ID" = EN."POBJ_ID") Y
    WHERE
    PRO.ID = :P1_PROJECTS AND
    PRO.ID = POBJ.PRO_ID AND
    :P1_PROJECTS = DECODE(X.PRO_ID,NULL,:P1_PROJECTS,X.PRO_ID) AND
    :P1_PROJECTS = DECODE(X.IDR_PRO_ID,NULL,:P1_PROJECTS,X.IDR_PRO_ID) AND
    POBJ.ID = DECODE(X.POBJ_ID,NULL,POBJ.ID,X.POBJ_ID) AND
    POBJ.ID = DECODE(X.IDR_POBJ_ID,NULL,POBJ.ID,X.IDR_POBJ_ID)
    AND
    :P1_PROJECTS = DECODE(Y.E_PRO_ID(+),NULL,:P1_PROJECTS,Y.E_PRO_ID(+)) AND
    :P1_PROJECTS = DECODE(Y.EN_PRO_ID(+),NULL,:P1_PROJECTS,Y.EN_PRO_ID(+)) AND
    POBJ.ID = DECODE(Y.E_POBJ_ID(+),NULL,POBJ.ID,Y.E_POBJ_ID(+)) AND
    POBJ.ID = DECODE(Y.EN_POBJ_ID(+),NULL,POBJ.ID,Y.EN_POBJ_ID(+))
    Problem is with the two full outer joins wht i am using
    there only i find the query taking too much time
    Thanks
    Sudhir
    Message was edited by:
    Sudhir_N
    Message was edited by:
    Sudhir_N

    You'll have to get an exection plan and manually tune the query.
    That aside, inline views can really slow queries down because once the data is stored in a temporary table you can't do fast indexed lookups on their result sets. They also make queries be more complicated. Also, outer joins tend to slow queries down a lot in general.

  • Urgen!! Query takes lots of time to execute and the production is in effect

    Hi,
    We have some data loading script. This scripts takes lots of time to execute. As Iam new to tunning please do let me know what is the wrong with the query !!
    Thanks In advance
    Query:
    =========
    INSERT /*+ PARALLEL */ INTO ris.ris_pi_profile
    (ID,COUNTRY_OF_CITIZENSHIP,IMMIGRATION_STATUS,SSN,DOB,GENDER,
    ETHNICITY,RACE,DEPARTMENT,DIVISION,INSTITUTION_ID,INST_EMAIL,EFFECT_DATE,ACADEMIC_TITLE,ACADEMIC_POSITION,
    OTH_PER_DATA,PCT_RESEARCH,PCT_TEACHING,PCT_CLINICAL,PCT_ADMIN,PCT_OTHER,PCT_TRAINING)
    SELECT
    ap.id,
    p.citizen_cd,
    decode(p.visa_cd,'CV',0,'F1',1,'H1',2,'H1B',3,'H2',4,'J1',5,'J2',6,'O1',7,'PR',8,'PRP',9,'TC',10,'TN',11,'TNN',12),
    (select n.soc_sec_num from sa.name n where n.name_id = p.name_id),
    (select n.birth_date from sa.name n where n.name_id = p.name_id),
    (select decode(n.gender_cd,'F',1,'M',2,0) from sa.name n where n.name_id = p.name_id),
    (select decode(n.ethnic_cd,'H',1) from sa.name n where n.name_id = p.name_id),
    (select decode(n.ethnic_cd,'A',2,'B',3,'I',1,'P',4,'W',5) from sa.name n where n.name_id = p.name_id),
    a.dept_name,
    a.div_name,
    a.inst_id,
    (select n.email from sa.name n where n.name_id = p.name_id),
    a.eff_date,
    ac.acad_pos_desc,
    p.acad_pos_cd,
    0,
    p.research_pct,
    p.teach_pct,
    p.patient_pct,
    p.admin_pct,
    p.other_pct,
    p.course_pct
    FROM
    appl1 ap,
    sa.personal_data p,
    sa.address a,
    sa.academic_pos_cd ac,
    profile_pi f
    WHERE
    p.project_role_cd='PI'
    and ap.appl_id=f.appl_id
    and p.appl_id=f.appl_id
    and p.name_id=f.name_id
    and a.addr_id=f.addr_id
    and p.acad_pos_cd=ac.acad_pos_cd
    AND EXISTS (select 1 from ris.ris_institution i WHERE i.id = a.inst_id)
    AND EXISTS (select 1 from sa.academic_pos_cd acp WHERE acp.acad_pos_cd = p.acad_pos_cd);
    In the execution PLan I see lots of Nested loop, Hash Join
    Index( Unique scan)
    Table Access by ( Index rowid)
    This query is fast in Test DB but ver very slow in prod DB. Need your help Urgent.
    Minaz

    When your query takes too long...
    When your query takes too long ...

  • Query takes lots of time to execute

    I have written a query which is computed from two separate views when i run the query it take 3 mins to execute
    how to reduce the time and excecute fast this is the query
    SELECT
    X."PRO_ID",
    X."POBJ_ID",
    X."Major",
    X."Minor",
    X."Normalized",
    X."IDR_PRO_ID",
    X."IDR_POBJ_ID",
    X."IDR"
    FROM
    PROJECTS PRO,
    PROJECT_OBJECTS POBJ,
    (SELECT
    MN."PRO_ID",
    MN."POBJ_ID",
    MN."Major",
    MN."Minor",
    MN."Normalized",
    DR."IDR_PRO_ID",
    DR."IDR_POBJ_ID",
    DR."IDR"
    FROM
    MAJOR_MINOR_NORMALIZED MN FULL OUTER JOIN IDR DR
    ON
    MN."PRO_ID" = DR."IDR_PRO_ID" AND
    MN."POBJ_ID" = DR."IDR_POBJ_ID" ) X
    WHERE
    PRO.ID = POBJ.PRO_ID AND
    PRO.ID = DECODE(X."PRO_ID",NULL,PRO.ID,X."PRO_ID") AND
    PRO.ID = DECODE(X."IDR_PRO_ID",NULL,PRO.ID,X."IDR_PRO_ID") AND
    POBJ.ID = DECODE(X."POBJ_ID",NULL,POBJ.ID,X."POBJ_ID") AND
    POBJ.ID = DECODE(X."IDR_POBJ_ID",NULL,POBJ.ID,X."IDR_POBJ_ID") AND
    PRO.ID = 2673
    any suggestion
    Thanks
    Sudhir
    Message was edited by:
    Sudhir_N

    If Pro.id = 2673, you don´t need the table PRODUCTS. You can simplify the query to
    SELECT
    X."PRO_ID",
    X."POBJ_ID",
    X."Major",
    X."Minor",
    X."Normalized",
    X."IDR_PRO_ID",
    X."IDR_POBJ_ID",
    X."IDR"
    FROM
    PROJECT_OBJECTS POBJ,
    (SELECT
    MN."PRO_ID",
    MN."POBJ_ID",
    MN."Major",
    MN."Minor",
    MN."Normalized",
    DR."IDR_PRO_ID",
    DR."IDR_POBJ_ID",
    DR."IDR"
    FROM
    MAJOR_MINOR_NORMALIZED MN FULL OUTER JOIN IDR DR
    ON
    MN."PRO_ID" = DR."IDR_PRO_ID" AND
    MN."POBJ_ID" = DR."IDR_POBJ_ID" ) X
    WHERE
    2673 = POBJ.PRO_ID AND
    2673 = DECODE(X."PRO_ID",NULL,2673,X."PRO_ID") AND
    2673 = DECODE(X."IDR_PRO_ID",NULL,2673,X."IDR_PRO_ID") AND
    POBJ.ID = DECODE(X."POBJ_ID",NULL,POBJ.ID,X."POBJ_ID") AND
    POBJ.ID = DECODE(X."IDR_POBJ_ID",NULL,POBJ.ID,X."IDR_POBJ_ID") Regards,
    Miguel

  • FETCH is taking lot of time when executing the program

    Hi,
    A program is lot of time in production though code looks ok.
    Only one select statement is there which fetches data from BKPF.
    Cost of the statement is as below:
    SELECT STATEMENT ( Estimated Costs = 51 , Estimated #Rows = 1 )
           2 TABLE ACCESS BY INDEX ROWID BKPF
             ( Estim. Costs = 51 , Estim. #Rows = 1 )
             Estim. CPU-Costs = 1,938,416 Estim. IO-Costs = 51
             Filter Predicates
               1 INDEX RANGE SCAN BKPF~Z1
                 ( Estim. Costs = 51 , Estim. #Rows = 1 )
                 Search Columns: 4
                 Estim. CPU-Costs = 1,936,841 Estim. IO-Costs = 50
                 Access Predicates Filter Predicates
    And in Se30 Execution time in Data base is 98.7% and Abap is 1.2%
    When I checked the Trace I found that the 2,487,732 & 84720,805 secs is being taken in the FETCH stage.
         27     BKPF               REOPEN               0     SELECT WHERE "MANDT" = '600' AND "GJAHR" = 2003 AND "BUKRS" = '0301' AND "BLART" = 'ZA' AND "BUDAT" = 20030319 AND "STBLG" = ' '
         2,487,732     BKPF               FETCH     406          0                                                  
         84,720,805     BKPF               FETCH     377          1403                                                  
    Can you please let me know what wrong in this? And what can I do to tune this fetch statement?
    Regards,
    Pooja

    Hi,
    so we can only use
    (MANDT)?
    BUKRS
    BLART
    as access predicates and
    STBLG
    as filter predicate.
    BUDAT schould be part of the access predicates i think.
    Watch out for an index where BUDAT can be used as access predicate....
    Kind regards,
    Hermann

  • Query taking lot of time (Tunning Query.... Help)

    SELECT d.loc_channel, A.DEPOT_CODE, F.DEPOT_NAME,E.EMP_CODE,E.EMP_NAME, A.CUST_CODE, B.CUST_NAME, A.INSTRUMENT_NO,to_char(A.INSTRUMENT_DT,'dd/mm/yyyy')as INSTRUMENT_DT ,nvl(A.amount,0)as amount, G.REMARKS indorcvdfrombank,G.DOC_NO,to_char(G.DOC_DT,'dd/mm/yyyy')as doc_dt,g.doc_dt docdt,nvl(G.DOC_AMOUNT,0)as doc_amount,decode(nvl(c.BDSNo,'N') ,'N','No','Yes') PAYRCVD,c.BDSNO,to_char(c.BDSDT,'dd/mm/yyyy')as BDSDT,nvl(c.amount,0)as bdsamount FROM T_PAYRECEIPT A, M_CUSTOMER B,T_PAYRECEIPT C,M_LOCATION D, M_EMPLOYEE E, M_DEPOT F, T_CRD_DBT G WHERE A.CUST_CODE = B.CUST_CODE AND B.SE_LOCCODE = D.LOCATION_CODE AND D.EMP_CODE = E.EMP_CODE AND A.DEPOT_CODE = F.DEPOT_CODE AND A.REF_DOCNO = G.DOC_NO AND A.DEPOT_CODE = G.DEPOT_CODE and nvl(A.status,' ') = 'B' and a.voucher_no = c.ref_instrumentno(+) and trunc(a.voucher_dt) between to_date('19/04/2005','dd/mm/yyyy') and to_date('19/05/2005','dd/mm/yyyy') AND A.Cust_Code exists (select A.cust_code from M_Customer A) AND A.Depot_code exists (select depot_Code from M_DEPOT where DEPOT_CATEGORY in ('D','L') and status = 'A' ) order by a.cust_code,g.doc_no,docdt

    While I agree with all of the other John's comments, as a first crack, I would re-write the statement this way:
    SELECT d.loc_channel, a.depot_code, f.depot_name,e.emp_code,e.emp_name,
           a.cust_code, b.cust_name, a.instrument_no,
           TO_CHAR(a.instrument_dt,'dd/mm/yyyy') instrument_dt,
           NVL(a.amount,0) amount, g.remarks indorcvdfrombank,
           g.doc_no,TO_CHAR(g.doc_dt,'dd/mm/yyyy') doc_dt, g.doc_dt docdt,
           NVL(g.doc_amount,0) doc_amount,
           DECODE(NVL(c.bdsno,'N'), 'N', 'No', 'Yes') payrcvd,
           c.bdsno,TO_CHAR(c.bdsdt,'dd/mm/yyyy') bdsdt,
           NVL(c.amount,0) bdsamount
    FROM t_payreceipt a, m_customer b,t_payreceipt c,m_location d,
         m_employee e, m_depot f, t_crd_dbt g
    WHERE a.cust_code = b.cust_code and
          b.se_loccode = d.location_code and
          d.emp_code = e.emp_code and
          a.depot_code = f.depot_code and
          a.ref_docno = g.doc_no and
          a.depot_code = g.depot_code and
          a.status = 'b' and
          a.voucher_no = c.ref_instrumentno(+) and
          TRUNC(a.voucher_dt) BETWEEN TO_DATE('19/04/2005','dd/mm/yyyy') AND
                                      TO_DATE('19/05/2005','dd/mm/yyyy') and
          f.depot_category IN ('d','l') and
          f.status = 'a'
    ORDER BY a.cust_code,g.doc_no,docdt The predicate:
    a.cust_code EXISTS (SELECT a.cust_code FROM m_customer a)can be removed because the join condition:
    a.cust_code = b.cust_codedoes exactly the same thing.
    The predicate:
    a.depot_code EXISTS (SELECT depot_code
                         FROM m_depot
                         WHERE depot_category IN ('d','l') and
                               status = 'a' ) can be removed because the join between:
    a.depot_code = f.depot_codewill take care of it if you add the conditions into the main query lilke:
    f.depot_category IN ('d','l') and
    f.status = 'a'The predicate:
    NVL(a.status,' ') = 'b'can be changed to a simple equality since NULL is not equal to anything. Removing the function may allow the optimizer to choose a better access path.
    I would try to change the predicate:
    TRUNC(a.voucher_dt) BETWEEN TO_DATE('19/04/2005','dd/mm/yyyy') AND
                                TO_DATE('19/05/2005','dd/mm/yyyy')to get rid of the TRUNC on voucher_dt. If there really are times in voucher_dt, I would probably use something like:
    a.voucher_dt BETWEEN TO_DATE('19/04/2005','dd/mm/yyyy') AND
                         TO_DATE('19/05/2005 23:59:59','dd/mm/yyyy hh24:mi:ss')If there are no times in voucher_dt then just drop the TRUNC.
    TTFN
    John

  • Sql query taking 2 much time to execute

    hi every body
    I am trying to JOIN two tables using the following criteria
    GL_JE_LINES.GL_SL_LINK_ID = CST_AE_LINES.GL_SL_LINK_ID
    but it takes too much time .. like (1 hr r more)
    which mens that something is wrong with my logic...
    any guidance will be appreciated ....
    thnx

    Hi,
    Do you run "Gather Schema Statistics" program on regular basis?
    What is the query you are trying to run?
    Please see the following threads.
    When your query takes too long ...
    When your query takes too long ...
    Post a SQL statement tuning request - template posting
    HOW TO: Post a SQL statement tuning request - template posting
    Regards,
    Hussein

  • Select Command taking a lot of time to execute

    Dear Experts,
    My below SELECT command taking a lot of time to execute.
          SELECT wid
                       matl_desc
                       INTO TABLE open_wid FROM zwb_table
                       WHERE ( weight2 = 0 OR weight2 IS NULL ).
    Table : zwb_table contains around 7 Lacs records. That's why taking a lot of time . I have also Indexed the table zwb_table with field WID & WEIGHT2 . (zwb_table contains only WID as Primary Key Field)
    Structure of Internal Table : open_wid ->
                                             wid LIKE zwb_table-wid,
                                             matl_desc LIKE zwb_table-matl_desc,
    Please suggest me how to Improve the Performance of the above Select command.
    Thanks in Advance
    JACK

    Hi Jack,
    you are having morethan 7lack records in z table. it is not good practice fetching all the records into internal table and restricting with where clause in loop statement.
    I hope you already created secondary index combination of primary key.
    check you select query fetching records based on index you have created in ST05.
    Refer below link for your program is using index that you have created.
    Re: Indexing
    Regards,
    Peranandam
    Edited by: peranandam chinnathambi on Apr 7, 2009 8:38 AM

  • Select query is taking lot of time to fetch data.....

    Select query is taking lot of time to fetch data.
        SELECT algnum atanum  abdatu abzeit abname abenum bmatnr bmaktx bqdatu bqzeit bvlenr bnlenr bvltyp bvlber b~vlpla
               bnltyp bnlber bnlpla bvsola b~vorga INTO TABLE it_final FROM ltak AS a
                       INNER JOIN ltap AS b ON  btanum EQ atanum AND algnum EQ blgnum
                       WHERE a~lgnum = p_whno
                       AND a~tanum IN s_tono
                       AND a~bdatu IN s_tocd
                       AND a~bzeit IN s_bzeit
                       AND a~bname IN s_uname
                       AND a~betyp = 'P'
                       AND b~matnr IN s_mno
                       AND b~vorga <> 'ST'.
    Moderator message: Please Read before Posting in the Performance and Tuning Forum
    Edited by: Thomas Zloch on Mar 27, 2011 12:05 PM

    Hi Shiva,
    I am using two more select queries with the same manner ....
    here are the other two select query :
    ***************1************************
    SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelpt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelptrprctr
        WHERE rldnr  = c_telstra_projects
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar             
          AND rpmax  = c_max_period.
    and the second one is
    *************************2************************
      SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelnt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelntrprctr
        WHERE rldnr  = c_telstra_networks
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar                              
          AND rpmax  = c_max_period.
    for both the above table program is taking very less time .... although both the table used in above queries have similar amount of data. And i can not remove the APPENDING CORRESPONDING. because i have to append the data after fetching from the tables.  if i will not use it will delete all the data fetched earlier.
    Thanks on advanced......
    Sourabh

  • Background task taking a lot of time to execute

    Hi,
    There is a background task in my workflow which is taking a lot of time to execute.
    I have tested it in dialog mode.. and it works fine.. takes just 2 mins.
    Only when the task is executed from background.. it takes about 10 mins.
    Is this a config problem? How do I check if it is so?

    you could try activating a trace (sql) and see what the differences are,.
    you could check if maybe user parameters are influencing this. Or ask your basis team if there are a lot of differences between syystem users and dialog users in terms of resource allocation.
    Did you find anything different whilst debugging it?
    Kind regards, Rob Dielemans

  • Script Logic taking a lot of time to execute

    Hi,
       I have a script logic which does the currency translation
    But it takes a lot of time to execute the same. can anyone suggest me to write a effective script logic to reduce the
    performance .
    I am using the input schedule that uses the script logic to execute with 6000 records.
    below is the script logic
    *LOOKUP RATE
       *DIM R_ACCT=[ACCOUNT].RATETYPE
       *DIM FX_LC1:R_CURRENCY ="LC1"
       *DIM FX_LC2:R_CURRENCY ="LC2"
       *DIM FX_LC3:R_CURRENCY ="LC3"
       *DIM FX_LC4:R_CURRENCY ="LC4"
       *DIM FX_LRC:R_CURRENCY ="LRC"
       *DIM R_ENTITY                     =GLOBAL
       *DIM SCENARIO                   =[SCENARIO]
       *DIM TIME                            =[TIME]
    *ENDLOOKUP
    *WHEN ACCOUNT.RATETYPE
    *IS "AVG","END"
       //TRANSLATE
       *WHEN CURRENCY
       *IS LC1
           *WHEN COMPANY.LC1
           *IS <> "NUL"
                *REC(FACTOR=LOOKUP(FX_LC1),CURRENCY=USD)
                *REC(FACTOR=LOOKUP(FX_LC1)/LOOKUP(FX_LRC),CURRENCY=LRC)
           *ENDWHEN
       *IS LC2
           *WHEN COMPANY.LC2
           *IS <> "NUL"
                *REC(FACTOR=LOOKUP(FX_LC2),CURRENCY=USD)
                *REC(FACTOR=LOOKUP(FX_LC2)/LOOKUP(FX_LRC),CURRENCY=LRC)
           *ENDWHEN
       *IS LC3
            *WHEN COMPANY.LC3
            *IS <> "NUL"
                *REC(FACTOR=LOOKUP(FX_LC3),CURRENCY=USD)
                *REC(FACTOR=LOOKUP(FX_LC3)/LOOKUP(FX_LRC),CURRENCY=LRC)
            *ENDWHEN
       *IS LC4
            *WHEN COMPANY.LC4
            *IS <> "NUL"
                 *REC(FACTOR=LOOKUP(FX_LC4),CURRENCY=USD)
                 *REC(FACTOR=LOOKUP(FX_LC4)/LOOKUP(FX_LRC),CURRENCY=LRC)
            *ENDWHEN
       *IS LC_USD
          *REC(FACTOR=1,CURRENCY=USD)
          *REC(FACTOR=1/LOOKUP(FX_LRC),CURRENCY=LRC)
       *ENDWHEN
    *ENDWHEN
    *COMMIT
    Kindly help as soon as possbile
    Edited by: Deepak_Hegde on Feb 2, 2012 4:58 PM

    Why wouldn't you use standard functionality with *RUN_PROGRAM CURR_CONVERSION?
    You'll have to call it multiple times since you want to translate into different currencies, but I think it will still be faster than this script.

  • Owb job taking too much time to execute

    While creating a job in OWB, I am using three tables,a joiner and an aggregator which are all joined through another joiner to load into the final table. The output is coming correct but the sql query generated is very complex having so many sub-queries. So, its taking so much time to execute. Pls help me in reducing the cost.
    -KC

    It depends on what kind of code it generates at each stage. The first step would be collect stats for all the tables used and check the SQL generated using EXPLAIN PLAN. See which sub-query or inline view creates the most cost.
    Generate SQL at various stages and see if you can achieve the same with a different operator.
    The other option would be passing HINTS to the tables selected.
    - K

  • Comma Separated Value Taking too Much Time to Execute

    Hi,
    select ES_DIAGNOSIS_CODE DC from ecg_study WHERE PS_PROTOCOL_ID LIKE 'H6L-MC-LFAN'
    The above query returns comma separated value from the above query.
    I am using the query below to split the comma separated value but the below query is taking lot of time to return the data.
    SELECT
    select DC from (
    with t as ( select ES_DIAGNOSIS_CODE DC from ecg_study WHERE PS_PROTOCOL_ID LIKE 'H6L-MC-LFAN' )
    select REGEXP_SUBSTR (DC, '[^,]+', 1, level) DC from t
    connect by level <= length(regexp_replace(DC,'[^,]*'))+1 )
    Please suggest me is there any alternative way to do this comma separated value.
    Thanks
    Sudhir

    Nikolay Savvinov wrote:
    Hi BluShadow,
    I know that this function is fast with varchar2 strings from several years of using it. With CLOBs one may need something faster, but the OP didn't menion CLOBs.
    Best regards,
    NikolayJust because you perceive it to be fast doesn't mean it's faster than doing it in SQL alone.
    For starters you are context switching from the SQL engine to PL/SQL to call it.
    Then in your code you are doing this...
    select substr(v_str,v_last_break+1, decode(v_nxt_break,0,v_length, v_nxt_break-v_last_break-1)) into v_result from dual;which is context switching back from the PL/SQL engine to the SQL engine for each entry in the string.
    Why people do that I don't know... when PL/SQL alone could do it without a context switch e.g.
    v_result := substr(v_str,v_last_break+1, case when v_nxt_break = 0 then v_length else v_nxt_break-v_last_break-1 end);So, if you still think it's faster than pure SQL (which is what the OP is using), please go ahead and prove it to us.

  • 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?

  • 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

Maybe you are looking for

  • Speed on the Airport Extreme

    Hi I have a Macbook running Leopard. Everything runs well. Ever since I bought the Airport extreme WIFI N router my connection speed to the connected external hard drive is rather slow..... Here is what i do.... I have a 250gig Mybook connected to th

  • Re-Color Art shifts colors around? How do I assign colors?

    How do I get the Re-color art to leave the assigned colors where they are. I have an item that comes in various color combinations. When I select re-color art and click on a pre saved color group, recolor art remaps the colors to different areas. I h

  • SELECT INTO statement

    Hello I have entered the following statement into the SQL Command Processor in HTML Db: select * into DEMO_CUSTOMERS_COPY from DEMO_CUSTOMERS I get the following error: ORA-00905: missing keyword Can anyone tell me why I'm getting this error? I think

  • Jdeveloper : Creating data bindings for dynamically rendered form

    In Jdeveloper application, I've created data controls using web service(WSDL). In my application, I have a form which is rendered at run time. How can I set the form da ta to the parameters inside the data control? Any help will be greatly appreciate

  • How to access and restore the files in recovery D on my HP Pavilion Windows 7??????

    Im not very good with the technological side of computers, but it asked me to restore to factory settings after turning my computer on in the morning. I asked it to back up my computer so I can restore it which I believe it did to the Recovery D driv