Adding HINTS produce a cost based plan ?

I have an SQL with Oracle Hints. If I do an explain plan report on this SQL, there is data under Rows, Bytes and Cost. If I remove the hints from the SQL, the explain plan has no data under rows, bytes, cost and a note: rule based optimization.
If I compute statistics on one of the tables used by the SQL, using ANALYSE TABLE as recommended, then I have a third explain plan, with data under rows, bytes and cost.
So how, in the absence of statistics, can Hints help produce a cost based plan ?

When you provide hints in the SQL statments you typically are controlling the execution path and the nature of join that SQL statment is choosing. This can give you good results or can slow down performance of your query as the time passes and database is subjected to changes.
If on the other hand you choose COST based optimization and collect statistics as recommended by Oracle then you make optimizer think instead of your self which yealds competative performance when you let optimizer engine decide the execution plan. So If i where you would think of performing following tasks.
1)Collect the statistics for all the tables and indexes refrenced in the SQL statment.
2)Set the optimizer goal to choose.
3) Vary the optimizer sampling size while collecting the statistics using ANALYZE command. In the past I have noticed that optimizer behavior will change as per the sampling so you might have to adjest your stats while using ANALYZE command to fine tune the behavior of SQL statment.
4)This should improve performance of your query.

Similar Messages

  • COST Element Based Planning

    Hello All,
    We are trying to plan cost of WBS Element based on cost elements.
    what we are trying to do -
    > CJ40, we want to plan on cost element level so on clicking the button "primary costs" (or via the menu: "Extras -> detailed planning -> Primary costs") we end up in an error message saying -
    Group INT-2 does not contain any entries
    Message no. K8004
    Diagnosis
    Group INT-2 does not contain any single values. You cannot use it in planning.
    System Response
    The SAP System rejects the planning layout and your entry.
    Procedure
    Use either a different group or enter values for group INT-2.
    CONFIGURATION for Planning Profile (T Code - OPSB) for the planning profile used in WBS Element Primary cost element group assigned is INT-2.
    Question2
    - Does cost element planning influenced by the cost element group assigned in the planning profile.
    - How to solve this error.
    Points assured.
    Warm Regards,
    Jatinder Bansal

    this is because in planning profile (Txn OPSB) you have INT-2 as cost element group and there are no cost elements assigned as pointed out by Venkat
    use transaction CJR2 instead of CJ40 and then plan for any cost element group or cost element that you already have

  • How planned values to be determined in (03) Cost-Based POC RA calculation

    Hi All
    We are implementing (03) Cost-Based POC  in our project . Pls guide me how Planned values flow to KKA2/KKAJ to determine POC %
    Pls help me ASAP
    Thanks
    Sneha

    Hi Srinu
    Thank u very much for ur help. It is working fine . Also ls confirm on these
    Planned cost : CJR2
    Planned revenue :  ??   ( Hope it is from Sales order)
    Actual cost :  ??   (Hope it is From MIGO)
    Actual revenue :  ??
    Pls do the needful
    Thanks
    Sneha

  • Restriction to only cost element based  planning against WBS

    HI Expert,
    here we need a scenario, like...user can only do cost element based planning against WBS.
    He should not be allowed to enter any manula cost directly against WBS.
    How to address  this issue.
    thanx in adv.
    regards
    Ashis

    Hi,
      Go to CJR2 t-code select the layout 1-702 and enter the wbs, cost element, periods, year and version and execute the transaction. Then enter the values and save.
    Remove the autorization for CJ40.
    Rgds
    Sudhir Reddy

  • Top Link Special Considerations in moving to Cost Based Optimizer....

    Our current application architecture consists of running a Java based application with Oracle 9i as the database and toplink as the object relational mapping tool. This is a hosted application about 5 years old with stringent SLA requirements and high availability needs. We are currently using Rule Based Optimizer (RBO) mode and do not collect statistics for the schemas. We are planning a move to Cost Based Optimizer (CBO)
    What are the special considerations we need to be aware of from moving RBO to CBO from top link perspective. Is top link code optimized for one mode over the other ?. What special parameter settings are needed ?. Any of your experience in moving Top Link based applications to RBO and best practices will be very much appreciated.
    -Thanks
    Ganesan Maha

    Ganesan,
    Over the 10 years we have been delivering TopLink I do not recall any issues with customizing TopLink for either approach. You do have the ability to customize how the SQL is generated and even replace the generated SQL with custom queries should you need to. This will not require application changes but simply modifications to the TopLink metadata.
    As of 9.0.4 you can also provide hints in the TopLink query and expression framework that will be generated into the SQL to assist the optimizer.
    Doug

  • Error while uploading cost element planning data into KP06 transaction

    Hi,
    I am facing the below error while uploading the Cost Element Planning excel file in KP06 transaction code. Please help me in fix this issue.
    We are trying to enter a budget upload using Transaction code: KP06. We get the following message errors  when we do this. It seems revenue accounts cannot be entered using cost centers. Question, how should these accounts be added? Kindly help me how to add Revenue cost elements to this planning?
    Error accured when generating data for the planning processor
    Messange no.K9400
    Revenue element 451000 can not be planned on cost center 9720
    Thanks
    Kishore

    The cost element which have  category 01 only can be planned in the Kp06.
    Regards
    Ranjan

  • MRP Type VV - Forecast Based Planning

    Hi all,
    My company would like to look at MRP Type "VV" - Forecast Based Planning (under Consumption-based Planning) for FG production materials.    I've read quite a bit about the concept and some based set up to how it works.   We would like to base Planned Orders > Production Orders based on this type of forecast planning.   It seem that SAP advises this kind of plannig for Raw Materials but not FG.   Anyway, what I really need to know are the specifics of how you set up the master data (in the Material Master) to properly execute this type of MRP: like....
    MRP Type: VV
    Lot Size: EX
    Period Ind:  W
    Availability Check: 02
    Forecast Period:   12
    Periods per Season: 12
    Historical periods:  60
    other fields I'm not sure......
    RP Profile:  ??
    Forecat Profile:  ??
    what else......?
    Also, what is the recommended approach to convert this forecast plan into Planned requirements to be converted to Production Orders?   
    I appreciate any further information I can get on MRP Type "VV" and how it works.   I appreciate your input!

    Thanks for the info nudratmaab.    Can you provide further data on what to expect given this forecast.....say I pick MVGA (Moving Average Forecast)?  So I enter some consumption (say last 12 months) and run forecast (MP38).    The MD04 shows the average requirement per "W" bucket:
    02/23/2012     ForReq     W 08/2012                16-
    02/27/2012     ForReq     W 09/2012               116-
    03/05/2012     ForReq     W 10/2012               116-
    03/12/2012     ForReq     W 11/2012               116-
    03/19/2012     ForReq     W 12/2012               116-
    03/26/2012     ForReq     W 13/2012               116-
    04/02/2012     ForReq     W 14/2012               116-
    04/09/2012     ForReq     W 15/2012               116-
    04/16/2012     ForReq     W 16/2012               116-
    04/23/2012     ForReq     W 17/2012               116-
    04/30/2012     ForReq     W 18/2012               116-
    05/07/2012     ForReq     W 19/2012               116-
    The next part is where it is a little foggy for me.   For "VV" do I run WRP1 (Replenishment) or do I run MD02/ 03 (MRP) and then what is the ForReq converted to (or does it even convert)?   I'm looking to implement this for Production Planning Requirements for Finished Produced products (I need them to convert to PldOrd (Planned Orders) to be converted to PrdOrd (Production Orders) by production scheduler.   
    The second part of this is the Raw Material (BOM component) associated with these Finished Goods. THese BOM components are set up as MRP Type "PD" and Lot size "EX" and I was hoping that the FG MRP run would also do BOM explosion and drive requirements for the Raw Material as well.....I'm not seeing that.   
    I need professional / expert to tell me how this works:    So MRP Type "VV" & Lot Size "EX" for the Finished Goods.......and MRP TYpe "PD" & Lot Size "EX" for the Raw Material (BOM Component).....
    THanks again!!

  • SQL 문장이 RULE 에서 COST-BASED로 전환되는 경우

    제품 : ORACLE SERVER
    작성날짜 : 2004-05-28
    SQL 문장이 RULE에서 COST-BASED로 전환되는 경우
    ==============================================
    PURPOSE
    SQL statement 문장이 자동으로 cost-based mode로 전환되는 경우에 대해
    알아보자.
    Explanation
    Rule-based mode에서 sql statement를 실행하더라도 Optimizer에 의해
    cost-based mode로 전환되는 경우가 있다.
    이런 경우는 해당 SQL이 아래와 같은 경우로 사용되는 경우 가능하다.
    - Partitioned tables
    - Index-organized tables
    - Reverse key indexes
    - Function-based indexes
    - SAMPLE clauses in a SELECT statement
    - Parallel execution and parallel DML
    - Star transformations
    - Star joins
    - Extensible optimizer
    - Query rewrite (materialized views)
    - Progress meter
    - Hash joins
    - Bitmap indexes
    - Partition views (release 7.3)
    - Hint (RULE 또는 DRIVING_SITE제외한 Hint가 왔을경우)
    - FIRST_ROWS,ALL_ROWS Optimizer의 경우는 통계정보가 없어도 CBO로 동작
    - TABLE 또는 INDEX에 Parallel degree가 설정되어 있거나,
    INSTANCE가 설정되어 있는 경우(DEFAULT도 해당)
    - Table에 domain index(Text index등) 이 생성되어 있는 경우

  • Cost Based Opt Question

    I have the following Select Statement:
    SELECT FGBTRND_SUBMISSION_NUMBER, FGBTRND_TRANS_AMT, FGBTRND_COAS_CODE, FGBTRND_FUND_CODE, FGBTRND_ORGN_CODE,
    FGBTRND_ACCT_CODE, FGBTRND_PROG_CODE, FGBTRND_ACTV_CODE, FGBTRND_LOCN_CODE, FGBTRND_RUCL_CODE
    FROM FGBTRND
    WHERE FGBTRND_DOC_CODE = 'F0022513'
    AND FGBTRND_RUCL_CODE IN ( SELECT FGBTRNH_RUCL_CODE FROM FGBTRNH
                        WHERE FGBTRNH_DOC_CODE = 'F0022513' )
    AND FGBTRND_LEDGER_IND='O'
    AND FGBTRND_FIELD_CODE='03' --:B4 01 02 03
    AND DECODE('Y','Y',BWFKPROC.F_SECURITY_FOR_WEB_FNC(FGBTRND_COAS_CODE, FGBTRND_FUND_CODE, FGBTRND_ORGN_CODE, 'PBEED'),'Y' ) = 'Y'
    AND ((FGBTRND_SUBMISSION_NUMBER IS NULL AND '0' IS NULL) OR (FGBTRND_SUBMISSION_NUMBER='0' ))
    This statement is ok without the following:
    AND DECODE('Y','Y',BWFKPROC.F_SECURITY_FOR_WEB_FNC(FGBTRND_COAS_CODE, FGBTRND_FUND_CODE, FGBTRND_ORGN_CODE, 'PBEED'),'Y' ) = 'Y'
    The call is to a security package which has to evaluate to Y inorder for the user to see the result. This statement in total would work fine provided the decode in the where clause is called last. However, the cost based optimizer is determining that it needs to evaluate this first.
    Question is:
    How do I get the cost based optimizer to evaluate the decode last and not first?
    I am on 10.2.0.3
    Patrick Churchill

    user3390467 wrote:
    " Consider setting your optimizer_index_caching parameter to assist the cost-based optimizer. Set the value of optimizer_index_caching to the average percentage of index segments in the data buffer at any time, which you can estimate from the v$bh view.
    Can someone give me the query to use to estimate from v$bh view mentioned above?
    What are other considerations for setting this parameter for optimizationThis post, and the flood of your other posts, appear to be quoting sections of a Statspack Analyzer report. Why are you posting this material here?
    If you want to set the optimizer_index_caching initialization parameter, first determine the purpose of the parameter. Next, determine if the current value of the parameter is causing performance problems. Next, determine if there are any unwanted side-effects. Finally, test the changed parameter, possibly at the session level or through an OPT_PARAM hint in affected queries.
    Here is a link to the starting point. http://download.oracle.com/docs/cd/B28359_01/server.111/b28320/initparams159.htm
    Blindly changing parameters in response to vague advice is likely to lead to problems.
    Charles Hooper
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

  • Cost center planning by functional area

    hi gurus,
    The client needs to do manual planning in CO (KP06) by cost center/cost element/fund/functional area. This data is later gets rolled up in FM to formulate the budget data. The client wants to enter all the account assignment manually except for functional area. They want that system automatically derive the functional area based on the cost center (one to one relationship). I tried the CO substitution but this functionality is only for actual data and not plan data. Any suggestion how I can derive the functional area in CO planning based on cost center?

    Hi,
    Functional area is required for cost of sales accounting in Finance. It has got nothing to do with Cost Center planning. Functional area shall not be visible in controlling. Pl update this constraint to the client and go ahead with Cost center/cost element planning with necessary one to one relationship with Fund center, etc.
    Trust this helps much!
    Cheers!

  • Results Analysis - Cost based POC method without margin

    Hello Experts,
    I would like to use the standard method - 03 , Cost based POC method but without margin. That means,
    1. System will calculate POC based on the actual costs and planned costs.
    2. Calulated revenue is created by multiplying the POC and the planned revenue.
    Here, Till the actual revenue is more than the planned costs, calculated revenue should be made equal to the actual costs.
    I have created standard method -03 and in the expert mode i have changed the profit indicator to " E - Profit Realization if actual revenue greater than planned costs"
    This works for first period when there is no actual revenue. After the actual revenue which is less than the planned cost,
    this does not work.
    Please let me know if you have any suggestion
    Thanks
    Regards
    Srinivasan Desingh

    in our projects I used to sit with CO consultant and do a lot of RA testing by changing different fields and finally reach the required result. Hit and Trial method (so it is hard to remember exactly what happen while changing a single field as there are many fields in expert mode). May be you can also try the same.

  • Please note that i am seeking some assistance with adding the followng resource: A maximum of 4 resources can be added at an additional cost of $500 per day per resource.

    Hi, Please note that i am seeking some assistance with adding the following resource to a task in Microsoft Project 2010:
    A maximum of 4 resources can be added at an additional cost of $500 per day per resource.

    Hi Clemence,
    Your post has quite little details, but as far as I understand, you want to add 4 resources on a task, each resource costing 500$ a day. Since it is not mentionned if it is generic resources (skill or role) or named resources, I'll assume that it is generic
    resources. Based on this understanding, here is a proposal:
    Go to the resource sheet,
    Create a work generic resource ("type" field set to "work", "generic" field to "yes"), typing in the resource name field the skill name,
    In the max unit field, enter 400% for 4 resources (for just 4 if  your Project 2010 is configured to display units in decimals),
    Since the rate is an hourly rate, make the calculation : 500$ per day / 8 hours a day = 62,5$ per hour,
    Go back to the Gantt Chart, split the window (click "detail" in the view tab of the ribbon),
    Select your task and assign the newly created resource with a given % units.
    Hope this helps.
    Guillaume Rouyre - MBA, MCP, MCTS

  • Rule based & Cost based optimizer

    Hi,
    What is the difference Rule based & Cost based optimizer ?
    Thanks

    Without an optimizer, all SQL statements would simply do block-by-block, row-by-row table scans and table updates.
    The optimizer attempts to find a faster way of accessing rows by looking at alternatives, such as indexes.
    Joins add a level of complexity - the simplest join is "take an appropriate row in the first table, scan the second table for a match". However, deciding which is the first (or driving) table is also an optimization decision.
    As technology improves a lot of different techiques for accessing the rows or joining that tables have been devised, each with it's own optimium data-size:performance:cost curve.
    Rule-Based Optimizer:
    The optimization process follows specific defined rules, and will always follow those rules. The rules are easily documented and cover things like 'when are indexes used', 'which table is the first to be used in a join' and so on. A number of the rules are based on the form of the SQL statement, such as order of table names in the FROM clause.
    In the hands of an expert Oracle SQL tuner, the RBO is a wonderful tool - except that it does not support such advanced as query rewrite and bitmap indexes. In the hands of the typical developer, the RBO is a surefire recipie for slow SQL.
    Cost-Based Optimizer:
    The optimization process internally sets up multiple execution proposals and extrapolates the cost of each proposal using statistics and knowledge of the disk, CPU and memory usage of each of the propsals. It is not unusual for the optimizer to analyze hundred, or even thousands, of proposals - remember, something as simple as a different order of table names is a proposal. The proposal with the least cost is generally selected to be executed.
    The CBO requires accurate statistics to make reasonable decisions.
    Even with good statistics, the complexity of the SQL statement may cause the CBO to make a wrong decision, or ignore a specific proposal. To compensate for this, the developer may provide 'hints' or recommendations to the optimizer. (See the 10g SQL Reference manual for a list of hints.)
    The CBO has been constantly improving with every release since it's inception in Oracle 7.0.12, but early missteps have given it a bad reputation. Even in Oracle8i and 9i Release 1, there were countless 'opportunities for improvement' <tm> As of Oracle 10g, the CBO is quite decent - sufficiently so that the RBO has been officially deprecated.

  • MRP based planning

    hi guys,
    what is MRP based planning and why it is used?Under what conditions do we go for MRP based plannig for procurement of materials?

    I will suggest you to read the SAP help on MRP first.
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/f4/7d3f9344af11d182b40000e829fbfe/frameset.htm
    Anyway i am trying to explainn you this functionality:
    The Concept Of MRP in SAP
    MRP in brief :
    MRP is the planning tool in SAP which will look at all aspects of a material and is highly based upon the master data of the material. MRP looks at current inventory, current requirements, open purchase req/orders and so on. So if a material is required to satisfy a sales order and there is no inventory, MRP will create a planned order if the item is to be produced in house. This planned order can then be converted to a production order by the master scheduler. If the item is to be procured, then MRP will create a purchase req which the Buyer will convert to a purchase order. This is just one scenario, the system is highly configurable and will do pretty much whatever you tell based on config and master data.
    Consumption based planning
    - Reorder planning
    - Forecast based planning
    - Time phased planning
    Details of re-order planning
    Our motive is to maintain optimum stock level of all the material included in the resource planning. so in this user or system sets a particular quantity of stock as reorder point . Whenever stock quantity fall below this point(reorder point) mrp comes into action and generates procurement proposals according to the settings done in implementation guide
    MRP run procedure
    1. Create requirement or demand in MD61
    2. MRP run by MD02 for a single material
    3. See the result in stock requirement list in MD04.
    MRP run we can carry out by
    1. MD02 - single item multi level
    2 .MD03 - single item single level
    3 .MD01 - Total planning
    4. MD04 Check MRP
    5. MD05 MRP lists
    Edited by: Manish Kumar Agarwal on Jun 4, 2009 12:23 PM

  • Cost Based Optimizer (CBO)

    not sure if this is a daft question or what. but i am trying to find out where exactly it exists.
    i know, when performing ST05 and viewing the execution plan, we see what the CBO has used, but is the CBO purely performed at the database server, and not at the SAP Application.
    When updating the statistics, are these passed to the database server, and once again, the CBO utilizes them for the execution plan, or do the database statistics actually reside in the database server.
    finally, in viewing the execution plan, the statement "execution costs = xxx" (xxx being a numeric value). what exactly is xxx. maybe an internal index used to compare  execution plans, or maybe the number of blocks required to read the "estimated #rows".
    anyone  ??
    thanks
    glen

    Hello Glen,
    So far as my knowledge is concerned, the statistics are actually located on the database server. That is what appears to be more logical too. what is the use of maintaining the access paths on tha application server ? Most of the modern database servers are equipped with the CBO functionality. And Cost-Based-Optimizing is dependent on the database.
    Here's what the documentation says:
    <i>You can update statistics on the Oracle database using the Computing Center Management System (CCMS). The transactions to be used are DB20 and DB21.
    By running update statistics regularly, you make sure that the database statistics are up-to-date, so improving database performance. The Oracle cost-based optimizer (CBO) uses the statistics to optimize access paths when retrieving data for queries. If the statistics are out-of-date, the CBO might generate inappropriate access paths (such as using the wrong index), resulting in poor performance.
    From Release 4.0, the CBO is a standard part of the SAP System. If statistics are available for a table, the database system uses the cost-based optimizer. Otherwise, it uses the rule-based optimizer.</i>
    Regards,
    Anand Mandalika.

Maybe you are looking for