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.

Similar Messages

  • Difference: Accounting Based & Costing Based OH

    Hello Everyone,
    What is the difference between Accounting Based OH & Costing Based OH?
    Thanks,
    Sneha
    Edited by: Sneha Latha on Sep 16, 2009 8:56 AM

    It has been asked dozens of time. Please, search SDN or lookt in http://help.sap.com
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/7a/4c37ef4a0111d1894c0000e829fbbd/frameset.htm

  • COPA -Acccount based and cost based

    Hi ,
    I want to know from BW Point of veiw ,
    what is the difference betwee costing based Ectractor and account based Extractor .
    Can some body explain me .
    Regards

    Data Source-Accounting Base:
    When we generate CO-PA Data Source select accounting based option.
    Fields KOKRS, BUKRS, KSTAR are compulsory.
    There are no Characteristics available for line Items because accounting based data sources do not contain characteristics.
    There are no value fields or calculated key figures available
    KOKRS and PERIO must be selected as selection fields.
    To Provide Data Source for BW all CO-PA Data Sources must be generated in the Source System.
    Data Sources can be defined at Operating Concern and client level.
    Data Source Contains the following Information
    Name of the Operating Concern
    Client
    Subset of the Characteristics
    Subset of the Value fields
    Time Stamp which data has already been loaded in to BW.
    Cost based:
    Cost based CO-PA is the form of Profitability Analysis that groups costs and Revenues according to value fields and costing based valuation approaches,both of which you can define your self.
    It gaurentees you can access at all times to complete,short-term profitability report.
    In Overhead cost controlling primary postings are made to objects in overhead cost controlling and assigned to relevant cost object. Actual cost of goods manufactured also assigned to cost objects and at the same time performing cost centers are credited
    Hope it will helps you........

  • What is Account-Based Costing ?

    Hi,
         Can anyone tell me, what is Account-based costing? What is role of it ?

    Hi,
    Two forms of Profitability Analysis are supported: costing-based and account-based.
    Costing-based Profitability Analysis is the form of profitability analysis that groups costs and revenues according to value fields and costing-based valuation approaches, both of which you can define yourself. It guarantees you access at all times to a complete, short-term profitability report.
    Account-based Profitability Analysis is a form of profitability analysis organized in accounts and using an account-based valuation approach. The distinguishing characteristic of this form is its use of cost and revenue elements. It provides you with a profitability report that is permanently reconciled with financial accounting.
    http://help.sap.com/saphelp_46c/helpdata/en/7a/4c37ef4a0111d1894c0000e829fbbd/content.htm
    Have many thread for you:
    COPA - Account Based & Costing Based clarification required...

  • Re: Oracle 8i (8.1.7.4) Rule based v/s Cost based

    Hi,
    I would like to know the advantages/disadvantages of using RULE based optimizer v/s COST based optimizer in Oracle 8i. We have a production RULE based database and are experiencing performance issues on some queries sporadically.
    TKPROF revealed:
    call       count       cpu    elapsed             disk                  query                current              rows
    Parse        0      0.00       0.00                0                      0                      0                      0
    Execute      3     94.67    2699.16            1020421            5692711            51404               0
    Fetch       13    140.93    4204.41             688482             4073366            0                      26896
    total       16       235.60    6903.57           1708903            9766077            51404               26896
    Please post your expert suggestions as soon as possible.
    Thanks and Regards,
    A

    I think the answer you are looking for is that Rule Based optimizer is predictive, but Cost Based optimizer results may vary depending on statistics of rows, indexes, etc. But at the same time, you can typically get better speed for OLTP relational databases with CBO, assuming you have correct statistics, and correct optimizer settings set.

  • 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

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

  • How can I know the database is using Cost Based or Rule Based?

    Hi all expertise,
    How can I know the database is using Cost Based or Rule Based?
    If cost based it is using, what methods are need to use to minimize the cost when database is running? And which tables I can see the performance of the database?
    Thanks
    Amy

    how to see database setting ?
    use this
    SQL> sho parameter optimizer
    NAME TYPE VALUE
    optimizer_dynamic_sampling integer 1
    optimizer_features_enable string 9.2.0
    optimizer_index_caching integer 0
    optimizer_index_cost_adj integer 100
    optimizer_max_permutations integer 2000
    optimizer_mode string CHOOSE
    choose means if table statistics is available then it will use cost
    else
    use rule based optimizer
    for seeing performnace of table use
    set autotrace on
    and run your query
    if it doen't show cost.it means it use rule based
    for using cost based
    u will calculate table statistics
    9i
    dbms_stats.gather_table_stats('owner','table');
    8i
    analyze table <table_name> compute statistics;
    hope it will help you
    kuljeet pal singh

  • In R12 can we have approval based on rules like Cost Cente or Account?

    Hi All,
    -In R12 GL can we have approval based on rules like Cost Centers or Account. I know a rule based on Amount can be setup
    -In R12 GL can we use the PO hierarchy and its Rules
    Thanks.

    Dear Srinivasan Muthu,
    Assuming that Red,Blue and white are the values for the chracteristic say Colour and if this assigned to
    a class type say 023 batch,while uploading the stock,the system asks the chracteristic value.
    Say suppose if you are entering 561in MB1C or 101 movement in MIGO for that material and if you
    select for Blue,then in MMBE you can click on the stock quantity and right click-->batch classification.
    The system shows for Blue colour.
    check and revert back.
    Regards
    Mangalraj.S

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

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

  • Sales order based costing

    1) How to caluculate the cost based on the sales order.cost Estimate with quantity strcture is possible or not
    PLEASE LET me know the status.
    with Regards
    Srinivas

    Hi,
    In Product Cost by Sales Order, costs are normally collected on sales order items.
    The quantity structure term is relevant to Production Orders which carries BOM and routing and your scenario is make-to-order.
    For each sales order item, you can plan the cost of goods manufactured or the cost of goods sold. The costing results can be used as a basis for pricing in the SD component.
    To be able to plan costs for sales orders, you must do the following:
    Define a costing variant and a valuation variant.
    Define a costing sheet for the calculation of overhead rates.
    Make sure that the MRP group in the MRP 1 view of the material master record specifies a requirements class that has account assignment category "E" (make-to-order) and that allows costing.
    In the requirements class, use the "Costing" indicator to specify that costing is allowed or updated and whether the planned costs are updated.
    In the requirements class, you also specify whether your sales order stock should be valuated or nonvaluated with the "Valuation" indicator.
    Results analysis at the end of the period is only required if you are using a nonvaluated sales order stock.
    To carry out results analysis, you must do the following:
    Define a results analysis key
    The results analysis key controls whether an object is selected for results analysis or WIP calculation. The results analysis key is defined as a separate default value for each requirements class.
    Define a results analysis version
    The results analysis version determines which of the results analysis versions are relevant to settlement. This is particularly important in multiple valuation.
    Choose a valuation method
    The valuation method controls which formula is used to calculate the results analysis data.
    To be able to settle the results analysis data to Profitability Analysis, you must define a PA transfer structure that assigns the results analysis data to value fields.
    To be able to settle the capitalized costs and the revenue in excess of billings and the reserves to Financial Accounting, you must:
    Set the indicator "Financial Accounting" in the results analysis version
    Define posting rules
    The posting rules assign the results analysis cost elements under which the results analysis data is updated on the order to G/L accounts (such as the finished products inventory or the reserves for unrealized costs (balance sheet) and the inventory change account or the expense account for reserves (P+L)).
    Regards,
    Sadashivan

  • Differance between the Cost based costing and Account based costing

    Hi,
    What is the Differance between the Cost Based Costing and Account Based Costing ?

    You can check sap note 69384
    COSTING-BASED PROFITABILITY ACCOUNT-BASED PROFITABILITY
    ANALYSIS ANALYSIS
    OBJECTIVE
    o profitability and sales accounting
    o evaluation of market segments (for example,
    customers, product groups, sales areas) and corporate
    units (for example, division, sales organization) with
    regard to their profit or contribution margins
    o calculation of profits procedures
    - cost-of-sales accounting
    - interim and reconciled sales report
    - periodic and transaction-based allocation
    - Profitability Analysis on the basis of full and
    direct costs
    o posted and costing-based values o account-based values
    o can be reconciled with FI for o always reconciled with
    account groups (revenues, sales FI on account level
    deductions, costs of goods
    Note 69384 - Information: Account-based Profitability Analysis
    manufactured, and so on)
    DATA STRUCTURES
    o definition of operating concerns o definition of operating
    with fixed characteristics and concerns with fixed and useruser-
    defined characteristics defined characteristics
    and value fields
    o cumulative storage by posting o cumulative storage by
    periods and weeks posting periods
    o storage in operating concern o controlling area currency,
    currency (as of Release 4.0 also company code currency
    optional in company code currency and transaction currency
    if req.)
    o user-definable summarization levels
    FUNCTIONS
    o transfer of profit relevant o transfer of profit-relevant
    business transactions from SD, FI activities from SD, FI, CO, MM
    CO, MM (revenues, sales deductions (revenues, sales deductions and
    and costs organized by value fields) costs organized by accounts)
    o Derivation of characteristics from master
    data or using derivation rules
    o Realignments also for data that is already
    posted
    o Valuation
    (Costs of goods manufactured, imputed
    costs and sales deductions)
    o sales and profit planning o profit planning
    - flexible layout - flexible layout
    - periodic distribution - periodic distribution
    - valuation, revaluation - forecast procedure
    - forecast procedure - top-down distribution
    - top-down distribution - simulation
    - simulation
    o profit analysis by means of 'interactive drill-down
    reporting'
    - Report Painter
    - object list/ranking lists, database schema
    - drill-down
    - key figure systems
    - flexible hierarchies
    - navigation between reports
    - exception reporting
    - ABC analyses
    - Exporting (Excel, Winword, Mail)

  • Account Based Vs Cost Based COPA - Char Derivation

    We're trying to implement both Cost based and Account based COPA at a client here.
    I have some derivation rules maintained in KEDR.
    When I'm trying to post a document in FI, the cost based COPA document is being created with the Characteristics populated correctly according to the derivation rules. However, in Account based COPA the characteristics are NOT getting derived.
    Can some tell me if there could be something I've missed?
    Thanks

    Hi
    Have you deactivated any of the characteristics used in Account based COPA
    Check KEQ3 and you may have activated only for Costing based COPA
    S Jayaram
    Edited by: S Jayram on Dec 18, 2007 3:24 PM

Maybe you are looking for

  • XI testing for two SAP R/3 systems with same system id/logical system

    Hi We are currently in the process of upgrading our R/3 4.7 to ECC 6.0 and plan to maintain dual landscape for DEV & QA (4.7 & ECC 6.0) for a period  for testing and maintaining existing applications for fixes etc. The second DEV & QA (upgraded to EC

  • My iMac can discover WiFi but won't connect how do i fix this?

    My iMac will discover WiFi connections, i type in the right password but it wont connect how do i fix this?

  • Is there an easy way to program a PIC16F77 via LabVIEW 7.1 and a DAQ?

    I am a student working on a senior design project that requires us to program a PIC16F77.  I have no experience with PIC programming, and was hoping for an easy way to do this in LabVIEW.  If anyone has done this before I would appreciate a few point

  • Renaming Servers in CR Server XI R2

    Hi, Currently, the cms name and the machine name are different. We copied over the vmware that had CR Server XI. First time I ran it, everything works fine. CMC and InfoView comes up fine. However, when I tried to run a report, I get an error saying

  • Looking for a Java tutor/mentor.

    Greetings. I've recently had quite a hard time figuring out the programing projects for my university computer science course. Seeing as how the teaching assistants aren't very helpful, I am in search of somebody who would be able to help me/discuss