DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Query Performance

  1. #1
    Join Date
    Nov 2002
    Location
    Mooresville, NC
    Posts
    349

    Arrow Query Performance

    I've one query which is executing in 2 seconds when i'm using hard coded value. But when i'm using bind variables the same query is taking 180 seconds. Could not understood what could cause the problem.

    Explain plan of both of the queries same.
    Thought of histograms and executed this query.
    select column_name from dba_tab_col_statistics where table_name = '&Table_name' and owner='&Owner' and NUM_BUCKETS>1 ;

    But this did not return any record. So i think none of the tables has histogram statistics and histograms is not the issue here.

    Any suggestions.
    http://www.perf-engg.com
    A performance engineering forum

  2. #2
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,334
    post the explain plans, prove they are the same

  3. #3
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    Did you supply uppercase names for the table and owner?
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  4. #4
    Join Date
    Nov 2002
    Location
    Mooresville, NC
    Posts
    349

    Arrow

    I found the proble. It was with the cardinality. Here is the sample query.
    select T23.CONFLICT_ID,
    T23.LAST_UPD,
    T23.CREATED,
    T23.LAST_UPD_BY,
    T23.CREATED_BY,
    T23.MODIFICATION_NUM,
    T23.ROW_ID
    from s_opty t23,S_OPTY_POSTN T1
    where T1.POSITION_ID = :1 AND
    T23.ROW_ID = T1.OPTY_ID
    and T23.TEMPLATE_FLG = :2

    TEMPLATE_FLG column has cardinality 1 and for that it's taking time.

    Now my question if i'll gather stat with histograms will that solve the problem as we can not modify the query so the bind varibale will be there for sure.
    http://www.perf-engg.com
    A performance engineering forum

  5. #5
    Join Date
    Nov 2001
    Location
    UK
    Posts
    152
    I think the answer is no, because Oracle decides on the execution plan before the bind variable assignment takes place. If you can't modify the query, you might be able to force the execution plan using stored outlines.

    http://download-uk.oracle.com/docs/c...3/outlines.htm

  6. #6
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    Quote Originally Posted by malay_biswal
    I found the proble. It was with the cardinality. Here is the sample query.
    select T23.CONFLICT_ID,
    T23.LAST_UPD,
    T23.CREATED,
    T23.LAST_UPD_BY,
    T23.CREATED_BY,
    T23.MODIFICATION_NUM,
    T23.ROW_ID
    from s_opty t23,S_OPTY_POSTN T1
    where T1.POSITION_ID = :1 AND
    T23.ROW_ID = T1.OPTY_ID
    and T23.TEMPLATE_FLG = :2

    TEMPLATE_FLG column has cardinality 1 and for that it's taking time.

    Now my question if i'll gather stat with histograms will that solve the problem as we can not modify the query so the bind varibale will be there for sure.
    This query comes from Siebel appln. Do you use CBO or RBO?
    What happened to the table T2 to T22?

    Tamil

  7. #7
    Join Date
    Nov 2002
    Location
    Mooresville, NC
    Posts
    349

    Arrow

    Obviously we use CBO. For simplicity i posted small version of the query. Do n't worry about the T2 and T22.
    http://www.perf-engg.com
    A performance engineering forum

  8. #8
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    Are both execution plans same?

    Tamil

  9. #9
    Join Date
    Nov 2002
    Location
    Mooresville, NC
    Posts
    349
    Problem here was with the explain plan, While executing it was picking different explain plan. In the tkprof o/p also it was not showing correctly. When i checked v$sql_plan , it was showing it was using index on template_flg column whose cardinality was 1. Drop that index, now all set. This issue was resolved long back, but just wanted to keep all of u updated.
    http://www.perf-engg.com
    A performance engineering forum

  10. #10
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    so... original posting about "Explain plan of both of the queries same" was wrong and, you never bother to post explain plans as Dave asked for. bad, bad, bad.
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width