Question bout using HINTS

Folks,
Say I have a sql which is using 20 tables and have 40 indexes (latest stat, newly rebuilt index).
What is the bottleneck/issue if I use 70% hints for this query? What is the best way to reduce use of Hints (perhaps not use at all) and gain performance?
regards,
Lily

The general concerns with using hints in production queries
- You may be covering up deficiencies in optimizer statistics. If the CBO isn't picking the best path for this query, it probably won't be picking the best path for other queries, so it's often more efficient to get to the root cause than to have to end up hinting lots of queries and/or suffering with poorly performing queries
- You may be preventing a future version of Oracle from using a more efficient path. The CBO is evolving all the time, if your hints are forcing a particular path, you're eliminating future changes that might help.
- Hints with syntax errors don't generate errors, they are silently ignored. This means that if someone modifies the query in the future and accidentally screws up one of your hints, it'll still run but may not run well.
- You may end up under-hinting a query, giving the CBO just enough room to do something screwy.
- Stored outlines (optimizer plan stability) tends to be a cleaner way to force the optimizer to use a particular query plan.
Justin

Similar Messages

  • Academic Question using HINTs

    Hi all
    I have a stored procedure with the code below (this is an excerpt)
    create or replace procedure queryone
    as
    abench integer;
    bbench integer;
    begin
    select count(*) into abench from bench where kseq=2;
    select count(*) into bbench from bench where k100k=2;
    dbms_output.put_line (abench || ' KSEQ');
    dbms_output.put_line (bbench || ' K100k');
    end;
    Now I have to use HINT as part of the assignment.
    I know I have to use SELECT /*+ all_rows*/ from ....and this is where I get lost..
    Am I on the right track? Do I put abench or bench after the from? I can't get either to work.
    Thanks so much

    If you really have to use a hint:
    select /*+ all_rows */ count(*) into abench from bench where kseq = 2;

  • What is the disadvantage of using hints in query

    hi all,
    i am report developer, in my project we were using hits in the query ... so that the query performance has improved ..
    my question is if we use hints in the query will it give any effects.. means to say instead of using hints we can make use of execution plan..
    what is the use of execution plan i don't know.. but i have an ideal about it .. if we change the execution plan then that will be use full i think
    please reply me,, if am wrong please correct me.. am not that much good at execution plan and hints in oracle..
    please tel me the difference between hints and execution plan and which one is better ?
    Thanks
    Raja

    Hint are used to bias the execution plan of a query. So there is no 'which is bettter'. Hints may be used to generate a different execution plan, but you can't predict how an execution plan looks like in the end. This decision is done by the db engine.
    It best to start without any hints and let the query optimizer do the work. For queries you feel run to slow you can try to give hints and see if your assumption is correct (when the execution time is faster with hints).
    On the other side your question is not related to jdev. You may ask the question in the {forum:id=75} forum
    Timo

  • Can we use hints in oracle 11g version ?

    can we use hints in oracle 11g version ? is it working ??

    Why do you ask these questions? Have you looked at the SQL Reference Guide and Performance Tuning Guide for your Oracle version - both which covers using hints?
    Have you see a statement that is not supported? Or does not work?
    Or are you simply doing idle speculation and expecting forum members to spend their free time in answering a basic question where the answer is ridiculously simply to find?

  • Using hints to improve performance

    Hi I am trying to create table using the below stmt. I am giving the counts on the tables also.
    It is taking 5-6 minutes to create the table. I am trying to improve its performance.
    Are my hints correct? What is nested look?
    Any suggestions.
    Thanks.
    create table dt_25_temp as
    select /*+ index(dt,DT_25_IDX) index(cl, T_CL_CLIENT_ID_CL_ID_IDX1 ) index(ml,T_MAILING_IDX2) index (ms ,t_ms_pk) use_nl(dupe,master)*/
    dt.id ,dt.l_id , dt.cl_id
    , ml.ml_id
    , ml.ml_u3
    , ms.t_cd
    , ml.ml_u1
    , ml.ml_u2
    , ml.ml_u4
    , ml.ml_u5
    from Dt_25 dt
    , t_ml ml
    , t_cl cl
    , t_ms ms
    where dt.cl_id = cl.id
    and cl.ml_id = ml.id
    and dt.ms_id = ms.id
    and cl.client_id = 12345
    and ml.client_id = 12345
    select count(1) from t_cl--1576262 records
    select count(1) from t_ml--280682
    select count(1) from t_ms--10341585
    select count(1) from dt_25--1092469 ( this is temporary table I create daily , it mave have 1000 to 1M records )
    DT_25_IDX is on column ID
    T_CL_CLIENT_ID_CL_ID_IDX1 is on client_id and id
    T_ML_IDX2 on id,cl_id
    t_ms_pk is on column id

    user10405034 wrote:
    Hi I am trying to create table using the below stmt. I am giving the counts on the tables also.
    It is taking 5-6 minutes to create the table. I am trying to improve its performance.
    Are my hints correct? What is nested look?
    Any suggestions.First of all, why are you using hints? If you have representative statistics in place and you're using the cost based optimizer it should be able to come up with a reasonable plan by itself. If not, you need to find out why. You should use hints only as a last resort, if you know something about your data that the optimizer simply doesn't know and therefore can't recognize.
    I wonder why you use the USE_NL hint if you're asking what a "nested look" (I assume you meant NESTED LOOP) is, suggesting that you don't know what this particular hint is about?
    - Can you show us the output of EXPLAIN PLAN using DBMS_XPLAN.DISPLAY? Use the \ tag before and after to use proper formatting in fixed font- What 4-digit version (e.g. 10.2.0.4) of Oracle are you using?
    - Given the fact that your DT_25 table might have significantly different sizes, the question is if the data from the other tables joined to will be restricted by the join or not. It would be possible that if your DT_25 table is small, a index access into the other tables might be faster, whereas if your DT_25 table is large and covers a lot of data from the other tables, a full table scan of those tables might be more appropriate.
    - How restrictive are these filter predicates specified:
    and cl.client_id = 12345
    and ml.client_id = 12345
    i.e. how many rows from the totals provided correspond to those predicates?
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to use hint on with clause query

    Hi all,
    I have a query and it consits full of tabs with WITH clause. Top level I am just selecting all the tabs (queries with WITH clause) by saying select * from tab1,tab2,.....so on .
    Now my question is If I want to use hint on my SQL can I use the same by using tab1,tab2...
    tab1, tab2 are not actually tables ....each tab represents one SQL with WITH clause.
    Please let me know if there is any confusion on my post.

    What's stopping you from trying it yourself?
    Post your results here to help others.

  • I have a question about using multiple ipads in our school.  Each of our teachers have a iPad and AppleTV in their classroom.  The issue is, with our classrooms so close in proximity to one another, is there a way to pair teacher

    I have a question about using multiple ipads in our school.  Each of our teachers have a iPad and AppleTV in their classroom.  The issue is, with our classrooms so close in proximity to one another, is there a way to pair teacher #1 iPad to its AppleTV without effecting/projecting onto the adjacent teachers #2 classroom AppleTV?

    Not as such.
    Give the AppleTV units unique names and also enable Airplay password in settings with unique passwords for each teacher.
    AC

  • About Using Hints in OWB

    Hi ALL
    I am facing one diffculty about using hints in OWB. Through the mapping configuration, i am trying to use INDEX hint for my table. The generated code is correct, but is a very redundant code. Hint is repeating multiple times in the sub query. Below is the sample:
    SELECT
    /*+ INDEX ("My_Table1") INDEX ("My_Table2") */
    Column1,
    Column2,
    Column3,
    Column4,
    Column5,
    Column6,
    Column7,
    Column8
    FROM
    ( SELECT
    /*+ INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2")
    Column9,
    Column10,
    Column11,
    Column12
    FROM
    ( SELECT .....
    The text under the hint ("My_Table1") INDEX ("My_Table2") is repeating again and again. Any way of controlling the code being generated..?

    From a performance standpoint, using hints in that manner may cause poorer performance than without. The INDEX (table_name) hint directs the optimizer to evaluate all relevant indexes. It is very easy to build an example where your column of interest is the last column in a multicolumn index and have a query perform worse than what a full table scan would produce. Oracle's recommendation is to "use hints sparingly" and that is for good reason.

  • Hi, I have quick question about use of USEBEAN tag in SP2. When I specify a scope of SESSION for the java bean, it does not keep the values that I set for variable in the bean persistent.Thanks,Sonny

     

    Make sure that your bean is implementing the serializable interface and that
    you are accessing the bean from the session with the same name.
    Bryan
    "Sandeep Suri" <[email protected]> wrote in message
    news:[email protected]..
    Hi, I have quick question about use of USEBEAN tag in SP2. When I
    specify a scope of SESSION for the java bean, it does not keep the
    values that I set for variable in the bean persistent.Thanks,Sonny
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • Tuning query without using hint

    Hi,
    i want to change the plan of a query without using hint.
    Also i want to use the plan that hint generate in my original query.
    My db is a 11g.
    How can i do this?
    tnx

    You can use SQL Plan Manager. You might find this interesting:
    http://blogs.oracle.com/optimizer/entry/what_should_i_do_with_old_hints_in_my_workload
    The link above basically suggests these steps:
    1. Run the query with the hints, then
    2. Take the plan from #1 and associate its SQL plan baseline with the query with no hints
    3. Remove the hints for that query in the code and start capturing and evolving plans for the un-hinted query

  • How to use hints in PL/SQL

    Hi,
    If I want to use hints in PL/SQL procedure, it is valid to write it this way:
    begin
    update /*+  INDEX(opp DIM_OPP_REFDB_IDX) */
            scott.rec_dim_opportunity opp
            set opp.mp_opportunity_re ....
    endI doubt when I tried it that the optimizer didn't actually use the index.
    Thanks in advance.
    Oracle 10g R1
    Windows 2003 32-bit

    the table is of 90MB and when the UPDATE statement is used in SQL, the explain plan output shows that the index is used.
    When I execute it from a procedure, the Current Statement show in TOAD doesn't show that the index is used and the update takes forever. Explain plan of the statement (as show in TOAD) shows that full table scan is being used.

  • Question about using new battery in old Powerbook

    I have a pre-intel Powerbook G4, and the battery is pretty much toast (lasts about 15 minutes now). I have ordered a new battery for it, and I have this question about using it:
    Am I smarter to keep the new strong battery out of the PB most days (as I usually work with it plugged in at home) and just pop it in when I know I will be out surfing on batteries? Or is it just as good living in my laptop 24/7 and only occasionally being called upon to do its job?
    Current bad Battery Information below:
    Battery Installed: Yes
    First low level warning: No
    Full Charge Capacity (mAh): 1144
    Remaining Capacity (mAh): 1115
    Amperage (mA): 0
    Voltage (mV): 12387
    Cycle Count: 281
    thanks folks, Shereen

    Hi, Shereen. Every Powerbook battery wants to be used — drained and then recharged — at least every couple of weeks. If you've always used your Powerbook on AC power nearly all the time, and not followed that pattern of discharging and recharging the battery every week or two, it's possible that your use habits have shortened the lifespan and prematurely diminished the capacity of your old battery. Of course it's also possible that your battery is merely old, as a battery's capacity also diminishes with age regardless of how it's used. You didn't say how old the battery is in years, so this may or may not be an issue. I mention it only because it can be an issue.
    For general information on handling a battery for the longest possible lifespan, see this article. My advice on the basis of that article and long experience reading these forums is that it would be OK to do as you propose, but I doubt that you'd derive any significant benefit from it. You would still want to be sure of putting the new battery through a charge/discharge cycle every week or two, even if you didn't have a reason to use the Powerbook away from home or your desk, because sitting unused outside the computer is just as bad for a battery as sitting unused inside it. And you should never remove the battery from your computer when it's completely or almost completely discharged and let it sit that way any longer than a day or two.
    Message was edited by: eww

  • Question about using TVARV in an ABAP program

    Hello gurus, Im sorry about the silly question.
    I have a question about using TVARV in an ABAP program.
    A program is presenting a problem and I think that in this code:
    SELECT SIGN OPTI LOW HIGH
      FROM TVARV
      INTO TABLE R_1_163431035_VELOCIDADE
      WHERE  NAME = '1_163431035_VELOCIDADE'
      AND    TYPE = 'S'.
      IF ZMM001-VELOCIDADE_B   IN R_1_163431035_VELOCIDADE AND
          ZOPERADORAS-OPERADORA = 'ABCD' AND
          ZMM001-MATERIAL       IN R_1_163431035_PRODUTO.
      ELSE.
      ENDIF.
    What happens is that the value "ZMM001-SPEED" B not exist in "R1_163431035_VELOCIDADE" but the program executes commands under the IF and not under the ELSE, as I imagine it would work. Is this correct ?
    I am new to ABAP programming, but I have a lot of XP in other programming languages ​​and this makes no sense to me.
    Anyone know where I can find some documentation of the use of "TVARV" in ABAP programs?
    I search the Internet if other programmers use TVARV this way, but found nothing, which leads me to think that was a quick and dirty solution that used here.
    If this is a bad way to program, what would be the best way?
    Regards
    Ronaldo.

    Hi Ronaldo,
    But in this case, the range is not empty, there are 17 records, in this way.:
    For the column "SING" all values ​​are "E"
    It means that the result is false if ZMM001-VELOCIDADE_B has the same value as one of the 17 records (E = exclude).
    For instance, if it has value 'C' and one of 17 records matches C, then the result is false.
    The "IF" with "IN" using "TVARV" as used in the program of the post above has the same behavior of a selection screen?
    Yes, the same behavior as the selection criterion to be exact. You can press the help key in the complex selection dialog for more info.
    I know it's a silly and very basic question, but other language that I used, only the SQL has the "IN" operator, but I think they work in different ways, so I would like to understand how it works in ABAP.
    Not silly ;-). Yes they work differently.
    More info here:
    - http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba74635c111d1829f0000e829fbfe/frameset.htm
    - http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba71f35c111d1829f0000e829fbfe/frameset.htm
    BR
    Sandra

  • Question about using Macbook in Vietnam.

    I have a question about using Macbook in Vietnam. I bought my mac here in the US, and I'm going to visit Vietnam, but I'm wondering if I can plug in the power directly into the wall or I have to need any convert power modem for my mac. The only thing I know that Vietnam use 220V so, can anyone help me?

    You may need a plug adaptor, but you don't need a power converter.
    (43828)

  • I have a question about using adobe CS files in CS6 edition

    I am a graphic artist . I have a question about using adobe CS files in CS6 edition. when I am gonna open thse adobe CS created files in CS6 Edition i get a color variation than i made with the CS version.Please give me an idea about this issue as soon as possible.If you need i can upload my problem as a screenshot to clearity

    donrulz,
    Are your Edit>Color Settings the same?
    Are you using spot colours, such as Pantone (there have been some changes in CMYK values with new colour books)?

Maybe you are looking for

  • Mac Mail Crashing when selecting Exchange Inbox

    Behavior started today.  I noticed i can be disconnected from the network and can access my inbox but once I connect, Mail crashes.  I've tried deleted the "container" files per other threads and numerous other work-arounds but I can't seem to get th

  • ("HTTP Code 200  : OK") SRT: Unsupported xstream found

    Hi, when I am trying send a request to an external webservice I am getting this message. Do you have an idea what can cause this error. Regards ilhan Server: SAP Web Application Server (ICM) HTTP/1.1 500 Internal Server Error set-cookie: MYSAPSSO2=Aj

  • Set a background using a still image (TIFF)?

    Hi, I am trying to use a still image as a background behind the text for visual placement and text effect evaluation. I have seen how to place a video, etc but can't seem to get a still in there. I can create a video from a still but trying to save s

  • I have a black screen on my 5S.

    I have a black screen on my 5S. I tried to renew the software, but every time tha message fault 40 appaers. What is that and how can I repair it.

  • Insert Fields From INSPECTOR DOCUMENT INFO into Pages Document

    I was able to do this since the DOS version of MS Word and would be rather surprised if there is no way to do it in Pages. Is there a way to insert "Document Info" about the present document into the present document? Am trying to work up my own temp