You are on page 1of 9

Oracle CBO and Siebel Business Applications [ID 478028.

1] Modified 30-OCT-2009 Type BULLETIN Status PUBLISHED

In this Document Purpose Scope and Application Oracle CBO and Siebel Business Applications Preparing and Administrating the Siebel Database for CBO Changes Made in Siebel 7.7, Siebel 7.8 and Siebel 8.0 for Supporting CBO References

Applies to:
Siebel System Software - Version: 7.7.2 [18325] to 8.0 [20405] - Release: V7 to V8 Information in this document applies to any platform. Area(s):Installation, System Administration Release(s):V7 (Enterprise), V7 (Professional), V8 (Enterprise), V8 (Professional) Database(s):Oracle App Server OS(s):All Supported Platforms Latest release tested against:V8 (Enterprise) Keywords:CBO, RBO, tuning, performance, 9i, parameter, statistics, cost, choose, optimizer This document was previously published as Siebel Technical Note 582. IMPORTANT NOTE: This document is no longer being updated. Ultimate reference for Oracle performance and tuning for Siebel Application is the White paper: Performance Tuning Guide for Siebel CRM Application on Oracle (Doc ID 781927.1)

Oracle Cost Based Optimizer (CBO) is supported for Siebel versions 7.7.x, 7.8.x, and 8.0 when deployed with Oracle RDBMS 9i and 10g. For Siebel version 7.5.x or earlier, the only optimizer mode supported is RULE for any of the database versions supported by the Siebel versions. Siebel Oracle RDBMS Version Version 7.5.x or higher 8.1.7.x (where x >= 3) 9.2.0.x (where x >= 2) 7.7.x or higher 8.1.7.x (where x >= 3) 9.2.0.x (where x >= 4) or 10.1.0.x (where x>= 4), higher 10.2.0.x. 7.8.x or higher 9.2.0. x (where x>=4) Optimizer Mode RULE RULE RULE RULE COST COST COST Init.ora parameter OPTIMIZER_MODE RULE RULE RULE RULE CHOOSE * ALL_ROWS CHOOSE

0.0.8.x. 7.2.0 10. On the other hand. Preparing and Administrating the Siebel Database for CBO When using Oracle‟s Cost Based Optimization with the Siebel database. then one of the RBO‟s rules specifies that this query will always be executed using the index. The CBO requires accurate statistics in order to deliver good query performance. Besides setting the OPTIMIZER_MODE to CHOOSE or ALL_ROWS. the execution plan for the sample query remains the same regardless of whether the EMP table has 10 rows or 10 million rows. Oracle CBO and Siebel Business Applications A query optimizer determines the best Execution Path for performing each query.x (where x>=3). . you may refer to the Oracle Database Reference Manual to get more information. ordered (fixed rank) set of plans based on a pre-defined set of rules and always picks the first applicable plan in the order.2 and above COST COST ALL_ROWS ALL_ROWS (*) except during the Upgrade process on 9i. The Oracle Rule Based Optimization (RBO) method chooses its plans based on a set of fixed rules. Some of the visible parameters are listed below. OPTIMIZER_MODE should be set to ALL_ROWS which is the default value. and regardless of whether the “EMPNO > 50” predicate will return 2 rows or 2 million rows. For example. it is crucial that the statistics the CBO uses are available and accurately maintained.1 document.8.7. 10. While the Cost Based Optimization method leverages a costing model based on statistics. The query optimizer chooses the plan with the most efficient cost (for example. The purpose of this document is to cover the main aspects of the Cost Based Optimizer mode and its relation with Siebel versions 7. Scope and Application This document is informational and intended for any user. the highest performance and lowest cost). and 8. there are some requirements that should be followed regarding the database parameters configuration and the Optimizer statistics generation on tables.0. The behavior of the RBO is entirely fixed. Hence. which evaluates all of the different access and join methods for the specific query and uses the most efficient one. OPTIMIZER_MODE should be set to CHOOSE unless you are performing an upgrade. 10.1. as specified below: Database Parameters For Oracle 10g. For Oracle 9i. about 60 other parameters affect the generation of the query plan (46 of them are hidden parameters). columns and indexes. the cost-based optimization strategy generates multiple execution plans for a given query. if you have a query of the form: SELECT * from EMP where EMPNO > 50 and if there is an index on column EMPNO.0. The details of these parameters are not within the scope of this document. RBO enumerates a deterministic.2. when the OPTIMIZER_MODE should be set to RULE as described in the Document 477789. with each having an estimated cost computed for each plan.

The following visible parameters must be set to their default values where applicable: Oracle Parameter HASH_JOIN_ENABLED OPTIMIZER_FEATURES_ENABLE OPTIMIZER_INDEX_CACHING OPTIMIZER_MODE PARTITION_VIEW_ENABLED QUERY_REWRITE_INTEGRITY STAR_TRANSFORMATION_ENABLED 9i Default Value True 9. if your db version is already 10. OPTIMIZER_MAX_PERMUTATIONS This parameter restricts the number of permutations of the tables the optimizer will consider in queries with joins. the following parameters need to be set to the recommended values other than default values.0 > Configuring the RDBMS > Configuring an Oracle Database for Siebel Applications > Guidelines for Configuring Settings in the init.ora File. a lower value carries the possibility of overlooking a good plan.   . In addition. based on the recommendations for visible parameters in version 9i. Siebel Installation Guide for UNIX Version 8.ora File. Refer to the Oracle documentation for further information. then you can set the OPTIMIZER_FEATURES_ENABLE=10. Hence.2. Tools Version 7.x.0 > Configuring the RDBMS > Configuring an Oracle Database for Siebel Applications > Guidelines for Configuring Settings in the init. for the Siebel application to work effectively and efficiently. this parameter has been made obsolete. Mobile Web Clients. NOTE: Starting with Oracle Database 10g.0 0 CHOOSE False Enforced False 10g Default Value ** Obsolete 10. Enable or disable query rewriting globally for the database 200 OPTIMIZER_INDEX_COST_ADJ QUERY_REWRITE_ENABLED 100 Fals (**) Do not automatically alter the values of these parameters which have been deprecated to hidden parameters in 10g.8 > Configuring the RDBMS > Configuring Oracle for Siebel Applications > Guidelines for Configuring Settings in the init.2.ora File. A higher value result in higher parse time.0 * 0 ALL_ROWS ** Obsolete Enforced False * It is always a good idea to set the OPTIMIZER_FEATURES_ENABLE = <Oracle DB patch version being used> to get full benefit of a series of optimizer feature supported by Oracle DB version.2. Siebel Installation Guide for Microsoft Windows: Servers.1.x. Controls the access path selection to be more or less index friendly. Oracle Parameter Description 9i Def Valu 1 OPTIMIZER_DYNAMIC_SAMPLING This parameter controls the level of dynamic sampling performed by the optimizer. The parameters below should be set according to the information documented in the following Siebel Bookshelf references:  Siebel Installation Guide for Microsoft Windows Version 8.

Dictionary Managed TEMP tablespac a multiple of the SORT_AREA_SIZE SORT_AREA_RETAINED_SIZE Specifies (in bytes) the maximum amount Set PGA_AGGREGATE_TARGET in of the user global area (UGA) memory PGA_AGGREGATE_TARGET . which Oracle uses to maintain a portion of the sort in memory. Tools Version 7.000 (1 MB). Mobile Web Clients.You users. to be used for hash joins. Collecting Optimizer Statistics General G For most production implementa of users. Tools Version 7. The following related parameters should be set by a trained DBA and according to the information in the applicable Oracle database documentation and requirements for your implementation. scan. STATISTICS_LEVEL All the advisories in Oracle9i Release 2 including the Buffer Cache Advisor are controlled by a newly introduced parameter STATISTICS_LEVEL. Oracle Parameter Description Recomme Valu DB_FILE_MULTIBLOCK_READ_COUNT The database buffer cache parameter For most implementations. It specifies the PGA_AGGREGATE_TARGET maximum amount of memory. in bytes. this value dictates the number of data blocks read in 32 blocks and adjusted as necessary a single Oracle I/O operation during a table value of 32. this value should be set PGA target advisory views for ad TYPICAL in production and ALL . Optimal perform the size of sorted queries.  Siebel Installation Guide for Microsoft Windows: Servers.7 > Guidelines for Configuring the RDBMS > Configuring Oracle for Siebel Applications.ora File. WORKAREA_SIZE_POLICY Specifies the policy for sizing work areas.Der retained after a sort run completes. the amount of RAM available.  Siebel Installation Guide for UNIX: Servers.8 > Configuring the RDBMS > Configuring Oracle for Siebel Applications > Guidelines for Configuring Settings in the init. PGA_AGGREGATE_TARGET is Optimizer Statistics Optimizer statistics on tables. and may Set PGA_AGGREGATE_TARGET in be adjusted according to the number of PGA_AGGREGATE_TARGET .000. Mobile Web Clients. This parameter If PGA_AGGREGATE_TARGET controls the mode in which working areas are tuned. SORT_AREA_SIZE This value is specified in bytes. HASH_AREA_SIZE Relevant to parallel execution operations and to the query Set PGA_AGGREGATE_TARGE portion of DML or DDL statements. columns and indexes are the single most important factor that drives the generation of optimal query plans. Mobile Web Clients. and of 1. it is important to ensure that accurate optimizer statistics are collected and made available to the query optimizer. Tools Version 7. As such. Siebel Installation Guide for UNIX: Servers. The retained size controls the size of the read buffer.7 > Guidelines for Configuring the RDBMS > Configuring Oracle for Siebel Applications. General guidance on these related settings is provided below: Oracle Parameter Description PGA_AGGREGATE_TARGET Specifies the target aggregate PGA memory available to all server processes attached to the instance.

Using a PL/SQL package DBMS_STATS Oracle Corporation highly recommends using the DBMS_STATS package for optimizer statistics maintenance. tabname => '<table name>'. Recommend this method when the initial optimizer statistics collection window is enough (depending on the table size it may take more time to complete) and space is not a constraint. Each one of them has advantages and disadvantages. However. cascade => TRUE.DEFAULT_DEGREE)  Collects only the optimizer statistics for the index. do not use it as a guideline.DEFAULT_DEGREE)  Collects the optimizer statistics for the table. method_opt => 'FOR ALL INDEXED COLUMNS'.GATHER_TABLE_STATS( ownname => '<table owner>'. tabname => '<table name>'. granularity => 'ALL'. Useful when you add a new index. granularity => 'ALL'. For more details. indexes and histograms for all indexes columns: EXECUTE DBMS_STATS. columns. EXECUTE DBMS_STATS.DEFAULT_DEGREE)  Collects the optimizer statistics for the table. degree => DBMS_STATS. indexed columns. please refer to the Oracle Database Performance and Tuning Guide and Reference. it should be mentioned that the more accurate optimizer statistics that are maintained will typically result in better execution plans. In general it is slower to execute therefore it would not be suitable when the optimizer statistic collection window is short. indexes and histograms for all columns.GATHER_INDEX_STATS( ownname => '<index owner>'. cascade => TRUE. Only collects histograms for skewed column.GATHER_TABLE_STATS( ownname => '<table owner>'.Oracle provides two ways for collecting optimizer statistics: 1. The examples below are only to illustrate some usages of DBMS_STATS to collect and delete statistics. This package has several options for collecting optimizer statistics. columns. granularity => 'ALL'. method_opt => 'FOR ALL COLUMNS SIZE SKEWONLY'. Using the ANALYZE command 2. degree => DBMS_STATS. EXECUTE DBMS_STATS. cascade => TRUE. method_opt => 'FOR ALL COLUMNS SIZE AUTO'.GATHER_TABLE_STATS( ownname => '<table owner>'. indexes and histograms for columns where the data shape is skewed. degree => DBMS_STATS. and Supplied PL/SQL Packages and Types Reference manuals. tabname => '<table name>'. indname => '<index name>') .  Collects the optimizer statistics for the table. EXECUTE DBMS_STATS.

all columns. USER_TABLES) o Number of row o Number of blocks o Average row length Column (DBA_TAB_COLUMNS.1:1 This script can be run from the Oracle SQL*Plus utility.----------.------------------.---------.---------. Verifying Optimizer Statistics The followings Optimizer statistics are used by the Cost-based Optimizer in Oracle RDBMS 9i and 10g.. ALL_TABLES. ALL_TAB_COLUMNS. USER_HISTOGRAMS) o Number of distinct value o Number of NULL o Density o Data distribution (Histograms) Index (DBA_INDEXES.  Deletes the optimizer statistics collected for the index: EXECUTE DBMS_STATS.  Table (DBA_TABLES. TABNAME LAST_ANALYZED NUM_ROWS BLOCKS AVG_ROW_LEN SAMPLE_SIZE -------------------. indexes associated with the table: EXECUTE DBMS_STATS. USER_INDEXES) o Number of leaf block o Distinct Key o Levels o Clustering factor   To verify the optimizer statistics. you may use the STAT.DELETE_INDEX_STATS( ownname => '<index owner>„. ALL_HISTOGRAMS. USER_TAB_COLUMNS. tabname => '<table name>'). The output lists the optimizer statistics and also let you know when it was last collected. DBA_HISTOGRAMS. Please refer to the Oracle Database Performance and Tuning Guide and Reference for more information. This helps you to understand the execution plan of a SQL statement and decide whether it is time to re-gather the statistics again. Example: SQL> @stat s_party Table .----------- ...DELETE_TABLE_STATS( ownname => '<table owner>'.SQL script provided below: Attachment 478028.Deleting Optimizer Statistics  Deletes the optimizer statistics collected for the tables. indname => „<index name>‟). You need to provide the table name after the file. ALL_INDEXES.

so that all column values in a band fall within the same range..----------ROW_ID 01-23-2004 11:58:25 5360604 0 . The histograms partition the values of the columns into bands.00000019 75 ROOT_PARTY_FLG 01-23-2004 11:58:26 2 0 .1:2 This script can also be run from the SQL*Plus utility.--------------. It helps the optimizer to choose a better plan only when the data is highly skewed and the SQL statement uses a literal... It is similar to the column distributions on DB2/UDB database.---------S_PARTY_F1 01-23-2004 11:58:32 23 15906 1 1 1030 1 S_PARTY_M1 01-23-2004 11:58:38 4837 2 2418 18798 37597 S_PARTY_M2 01-23-2004 11:59:31 13232 4679585 1 1 5475889 S_PARTY_M3 01-23-2004 12:00:21 13716 4679801 1 1 5059433 S_PARTY_M4 01-23-2004 12:00:59 9387 4679568 1 1 5233052 S_PARTY_P1 01-23-2004 11:58:31 6570 5468509 1 1 254834 S_PARTY_U1 01-23-2004 12:01:04 11084 5460497 1 1 110498 To verify the histograms.00000019 1 PARTY_TYPE_CD 01-23-2004 11:58:25 9 0 .------------------.------------------.00000010 17 NAME 01-23-2004 11:58:26 4654599 138347 .SQL script provided below: Attachment 478028.---------.00007114 75 Index(s) .---------.-----------.---------..---------. you may use the COLDIST.00000009 1 GROUP_TYPE_CD 01-23-2004 11:58:26 18 145776 .. ENDPOINT_NUMBER ENDPOINT_VALUE --------------. You need to provide the table name and column name to get the histograms.S_PARTY Columns(s) .00000111 75 PAR_PARTY_ID 01-23-2004 11:58:26 15906 5344562 .-------------31 3.3952E+35 73803 3.. Example: SQL> @coldist S_PARTY..---------.7611E+35 CF 2 2 2 2 2 .. 01-23-2004 11:58:25 5360604 32602 100 5360604 COLUMN_NAME LAST_ANALYZED NUM_DISTINCT NUM_NULLS DENSITY NUM_BUCKETS -----------------------------..00000009 8 PARTY_UID 01-23-2004 11:58:25 5360604 0 .PARTY_TYPE_CD Histograms .00000019 75 CREATED CREATED_BY LAST_UPD LAST_UPD_BY MODIFICATION_NUM CONFLICT_ID 01-23-2004 11:58:25 67931 0 . INDNAME LAST_ANALYZED LFBLK DKEYS ALVLBLK AVGDBLK BLEVEL -----------------.---------.

5. 7.0.8 and 8. Siebel 7.ora file:   _b_tree_bitmap_plans = FALSE _no_or_expansion = FALSE The Siebel database connector makes the following session level changes. For better performance in Siebel versions 7. with optimizer mode set as CBO. to change the optimization technique to all rows.2. NOTE: Parameter HASH_JOIN_ENABLED has been deprecated to the hidden parameter _HASH_JOIN_ENABLED in Oracle 10g. which causes the following message to appear in the database alert log file: 08:59:06 2005 ALTER SESSION SET hash_join_enabled specifies an obsolete parameter Change Request 12-R5WXCB has been logged to address this product defect by changing the parameter HASH_JOIN_ENABLED to the hidden parameter _HASH_JOIN_ENABLED preventing the alert log error message.8 and Siebel 8.1764E+35 4.2 and 7. Typically the client queries fetch a screen full of rows.4369E+35 Changes Made in Siebel 7.8. This makes it important to optimize the query plan for returning the first few rows quickly. Siebel 7.2.0 for Supporting CBO Some changes were made in the Siebel application to support Oracle CBO in Siebel 7.7. .7. keep the cursor open and fetch more rows when the user presses next record set or next record on the last row. The behavior has been fixed in Siebel versions 8.0 connecting to Oracle 10. The changes were mainly for the first rows optimization for the client queries. it has been observed that SQL query performance is satisfactory with the following two parameter settings in the init.8 and Siebel 8. for Oracle 9i.1843632 5309265 5360486 5360493 5360507 5360521 5360604 4. ALTER SESSION SET _HASH_JOIN_ENABLED = FALSE.1.2.1251E+35 4.3334E+35 4.0.x or 10. These are done by issuing the following command: ALTER SESSION SET _OPTIMIZER_JOIN_SEL_SANITY_CHECK = TRUE Whenever the query fetches all rows.x.1770E+35 4. for Oracle 10g Disables sort-merge: ALTER SESSION SET _OPTIMIZER_SORTMERGE_JOIN_ENABLED = FALSE Enables sanity check for join using two columns. a hint /*+ all_row */ gets appended to the SQL statement after the SELECT clause. The alert log message regarding the deprecated parameter can be safely ignored in situations where it is generated.1744E+35 4.3334E+35 4.7. when the SQL style is set to Oracle CBO:     Sets the optimization mode to the first_rows_10: ALTER SESSION SET OPTIMIZER_MODE = FIRST_ROWS_10 Disables hash join: ALTER SESSION SET HASH_JOIN_ENABLED = FALSE.

1 which documents that you may encounter slow performance behaviors when using Oracle database version 9. Document 477690.   Oracle Database Performance and Tuning Guide and Reference.7.  Document 478242.1 which documents that sub-optimal execution plan can be generated by the Oracle Optimizer if the statistics are generated on empty (542 B) Related Products  Siebel > Customer Relationship Management > CRM . Document 477789.Enterprise Edition > Siebel System Software . Oracle Database (727 B) technote582-2_coldist.x with Siebel eBusiness Application versions prior to Siebel version 7.1 which documents that when upgrading to Siebel version 7.References Below are some additional references:    Document 476301. This document was previously published as Siebel Technical Note 582. Attachments technote582-1_stat. you must use the rule based optimizer during the upgrade.7 applications on Oracle 9i.x applications only support Rule based optimizer on Oracle databases.1 which documents that Siebel version 6.