what will be right way to deal with this query
DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: what will be right way to deal with this query

  1. #1
    Join Date
    Dec 2005
    Posts
    11

    what will be right way to deal with this query

    Hi All,

    I have on single line query. i alway see this query fired
    on my database.this query fetch single column and cpu cost is too high 1637557 and cost is only 26.this query is fired reguarly.
    what will be better way to deal with this query.

  2. #2
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    Try re-writing the query. What is the optimizer mode? Are the tables involved analyzed?
    Thanx
    Sam



    Life is a journey, not a destination!


  3. #3
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    What is the query? something like
    Code:
    select username from dual;
    or
    Code:
    select sysdate from dual;
    David Aldridge,
    "The Oracle Sponge"

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

    Oracle ACE

  4. #4
    Join Date
    Dec 2005
    Posts
    11
    select code12 from m_s12 where flnt402 =:1 order by code12
    this the query that is taking cpu cost is too high 1637557 and cost is 26.
    what we can do with this.
    what u suggest me to do.

  5. #5
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    What's the explain plan, how many rows is it retrieving, is flnt402 indexed, is the table index-organized?

    Also, why is this code being executed so many times? Is it a case of PL/SQL looking up values then joining to another data set through PL/SQL code instead of through SQL?
    David Aldridge,
    "The Oracle Sponge"

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

    Oracle ACE

  6. #6
    Join Date
    Dec 2005
    Posts
    11
    it is fetching 7262 rows and the column is indexed primary key
    it is used as part of pl/sql

  7. #7
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    it's building a list to use as a lookup table inside PL/SQL?
    David Aldridge,
    "The Oracle Sponge"

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

    Oracle ACE

  8. #8
    Join Date
    Dec 2005
    Posts
    11
    we can not do anything regarding this query

  9. #9
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    How fragmented the table is? What does the explain plan show? What is the optimizer it was trying to make use of in the explain plan? Also is it a simple pk or composit pk?


    Thanx
    Sam
    Last edited by sambavan; 12-12-2005 at 04:08 PM.
    Thanx
    Sam



    Life is a journey, not a destination!


  10. #10
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    If you can make this an index-organized table on a composite pk of (flnt402,code12) then that would be beneficial.
    David Aldridge,
    "The Oracle Sponge"

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

    Oracle ACE

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