Quantcast
Channel: Timur Akhmadeev's blog » 11g

OPT_PARAM and OPTIMIZER_FEATURES_ENABLE

$
0
0

Here’s a question appeared on the oracle-l mailing list recently:

Does anyone know if opt_param hint works with optimizer_features_enable in 11.1.0.7?

My first thought was “it should work”. Even though documentation doesn’t confirm that OPT_PARAM works for many CBO-related parameters, usually it works fine. I’ve written a case to check this out for OPTIMIZER_FEATURES_ENABLE, but it revealed that OPT_PARAM is useless in such case, because effectively it can’t change OPTIMIZER_FEATURES_ENABLE session parameter (thought it tries).

select * from v$version;

drop table t cascade constraints purge;
create table t as select * from all_objects where rownum <= 5000;

explain plan for
select object_type, count(*)
  from t
 group by object_type;
select * from table(dbms_xplan.display(null,null,'outline'));

explain plan for
select /*+ opt_param('optimizer_features_enable' '9.2.0') */
    object_type, count(*)
  from t
 group by object_type;
select * from table(dbms_xplan.display(null,null,'outline'));

I’ve used OUTLINE as a third parameter of dbms_xplan to get the hints Oracle has “put” to the query during optimization phase. This is what I’ve got:

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------
Plan hash value: 47235625

---------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |  5121 | 56331 |    22   (5)| 00:00:01 |
|   1 |  HASH GROUP BY     |      |  5121 | 56331 |    22   (5)| 00:00:01 |
|   2 |   TABLE ACCESS FULL| T    |  5121 | 56331 |    21   (0)| 00:00:01 |
---------------------------------------------------------------------------

Outline Data
-------------

  /*+
      BEGIN_OUTLINE_DATA
      USE_HASH_AGGREGATION(@"SEL$1")
      FULL(@"SEL$1" "T"@"SEL$1")
      OUTLINE_LEAF(@"SEL$1")
      ALL_ROWS
      DB_VERSION('11.2.0.1')
      OPTIMIZER_FEATURES_ENABLE('11.2.0.1')
      IGNORE_OPTIM_EMBEDDED_HINTS
      END_OUTLINE_DATA
  */

Note
-----
   - dynamic sampling used for this statement (level=2)

PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------
Plan hash value: 47235625

---------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |  5121 | 56331 |    22   (5)| 00:00:01 |
|   1 |  HASH GROUP BY     |      |  5121 | 56331 |    22   (5)| 00:00:01 |
|   2 |   TABLE ACCESS FULL| T    |  5121 | 56331 |    21   (0)| 00:00:01 |
---------------------------------------------------------------------------

Outline Data
-------------

  /*+
      BEGIN_OUTLINE_DATA
      USE_HASH_AGGREGATION(@"SEL$1")
      FULL(@"SEL$1" "T"@"SEL$1")
      OUTLINE_LEAF(@"SEL$1")
      ALL_ROWS
      OPT_PARAM('_fix_control' '4488689:1 4308414:1 4569940:1 4631959:1
              4519340:1 4550003:1 4554846:1 4602374:1 4584065:1 4545833:1 4611850:1
              4663698:1 4663804:1 4666174:1 4567767:1 4556762:15 4728348:1 4708389:1
              4175830:1 4752814:1 4583239:1 4386734:1 4887636:1 4545802:1 4605810:1
              4704779:1 4900129:1 4924149:1 4663702:1 4878299:1 4658342:1 4881533:1
              4676955:1 4273361:1 4967068:1 4705343:1 4716096:1 4722900:1 4615392:1
              5096560:1 4134994:1 4904890:1 5104624:1 5014836:1 4768040:1 4600710:1
              5129233:1 4595987:1 4908162:1 5139520:1 5084239:1 5099909:1 5240607:1
              5195882:1 5220356:1 5263572:1 5385629:1 5302124:1 5391942:1 5384335:1
              5482831:1 4158812:1 5387148:1 5383891:1 5466973:1 5396162:1 5394888:1
              5395291:1 5236908:1 5509293:1 5449488:1 5567933:1 5570494:1 5288623:1
              5505995:1 5505157:1 5112460:1 5554865:1 5112260:1 5112352:1 5547058:1
              5618040:1 5585313:1 5547895:1 5634346:1 5620485:1 5483301:1 5657044:1
              5694984:1 5650477:1 5611962:1 4279274:1 5741121:1 5714944:1 5391505:1
              5762598:1 5578791:1 5259048:1 5882954:1 5707608:1 5891471:1 5884780:1
              5680702:1 5371452:1 5838613:1 5949981:1 5624216:1 5741044:1 5976822:1
              6006457:1 5872956:1 5923644:1 5844495:1 4168080:1 6020579:1 5996801:1
              5593639:1 6133948:1 3151991:1 6146906:1 6239909:1 6267621:1 6279918:1
              6141818:1 6151963:1 6251917:1 6282093:1 6119510:1 6119382:1 5944076:1
              5406763:1 6070954:1 6282944:1 6138746:1 6082745:1 3426050:1 599680:1
              6062266:1 6087237:1 6122894:1 6377505:1 5893768:1 6163564:1 6073325:1
              6188881:1 6007259:1 6239971:1 6042205:1 6051211:1 6434668:1 6438752:1
              5936366:1 6439032:1 6438892:1 6006300:1 5947231:1 6365442:1 6239039:1
              6502845:1 6913094:1 6029469:1 5919513:1 6057611:1 6469667:1 6368066:1
              6329318:1 6656356:1 4507997:1 6671155:1 6694548:1 6688200:1 6612471:1
              6326934:1 6714199:1 6681545:1 6748058:1 6167716:1 6674254:1 6468287:1
              6503543:1 6766962:1 6120483:1 6670551:1 6771838:1 6530596:1 6778642:1
              6699059:1 6376551:1 6429113:1 6782437:1 6776808:1 6765823:1 6768660:1
              6782665:1 6610822:1 6514189:1 6818410:1 6827696:1 6773613:1 5902962:1
              6956212:1 3056297:1 6904146:1 6221403:1 6845871:1 5468809:1 6917633:1
              6994194:1 6951776:1 5648287:3 7132036:1 6980350:1 5199213:1 7138405:1
              7148689:1 6820988:1 7032684:1 7155968:1 7127980:1 6982954:1 7241819:1
              6897034:1 7236148:1 7298570:1 7249095:1 7314499:1 7324224:1 7289023:1
              7237571:1 7116357:1 7345484:1 7375179:1 5897486:1 6774209:1 7306637:1
              6451322:1 7208131:1 7388652:1 7127530:1 6751206:1 6669103:1 7430474:1
              6990305:1 7043307:1 3120429:1 6838105:1 6769711:1 6528872:1 7295298:1
              5922070:1 7259468:1 6418552:1 4619997:1 6942476:1 6418771:1 7375077:1
              5400639:1 4570921:1 7426911:1 7528216:1 7521266:1 7385140:1 7576516:1
              7576476:1 7165898:1 7263214:1 3320140:1 7555510:1 7613118:1 7597059:1
              7558911:1 5520732:1 7449971:1 3628118:1 4370840:1 7281191:1 7519687:1
              5029592:3 6012093:1 7696414:1 7272039:1 7834811:1 7341616:1 7168184:1
              399198:1 7831070:1 7414637:1 7585456:1 8202421:1 8251486:1 7132684:1
              6972987:1 7199035:1 8243446:1 7650462:1 7592673:1 7718694:1 7534027:1
              7708267:1 5716785:1 7356191:1 7679161:1 7597159:1 7499258:1 8328363:1
              7452863:1 8284930:1 7298626:1 7657126:1 8371884:1 7135745:1 8356253:1
              8323407:1 8289316:1 8447850:1 7675944:1 8355120:1 7176746:1 8442891:1
              8373261:1 7679164:1 8408665:1 8491399:1 8348392:1 8508056:1 8335178:1
              8515269:1 8247017:1 7325597:1 8531490:1 8557992:1 7556098:1 8580883:1')
      OPT_PARAM('_optimizer_try_st_before_jppd' 'true')
      OPT_PARAM('_optimizer_use_feedback' 'true')
      OPT_PARAM('_optimizer_distinct_placement' 'true')
      OPT_PARAM('_and_pruning_enabled' 'true')
      OPT_PARAM('_optimizer_table_expansion' 'true')
      OPT_PARAM('_optimizer_use_cbqt_star_transformation' 'true')
      OPT_PARAM('_optimizer_join_factorization' 'true')
      OPT_PARAM('_connect_by_use_union_all' 'true')
      OPT_PARAM('_optimizer_eliminate_filtering_join' 'true')
      OPT_PARAM('_optimizer_connect_by_elim_dups' 'true')
      OPT_PARAM('_aggregation_optimization_settings' 0)
      OPT_PARAM('_optimizer_distinct_agg_transform' 'true')
      OPT_PARAM('_optimizer_unnest_corr_set_subq' 'true')
      OPT_PARAM('_optimizer_unnest_disjunctive_subq' 'true')
      OPT_PARAM('_optimizer_fast_access_pred_analysis' 'true')
      OPT_PARAM('_optimizer_fast_pred_transitivity' 'true')
      OPT_PARAM('_optimizer_coalesce_subqueries' 'true')
      OPT_PARAM('_bloom_folding_enabled' 'true')
      OPT_PARAM('_optimizer_extended_stats_usage_control' 224)
      OPT_PARAM('_nlj_batching_enabled' 1)
      OPT_PARAM('_optimizer_fkr_index_cost_bias' 10)
      OPT_PARAM('_optimizer_enable_extended_stats' 'true')
      OPT_PARAM('_optimizer_native_full_outer_join' 'force')
      OPT_PARAM('_optimizer_connect_by_combine_sw' 'true')
      OPT_PARAM('_optimizer_enable_density_improvements' 'true')
      OPT_PARAM('_optimizer_improve_selectivity' 'true')
      OPT_PARAM('_optimizer_adaptive_cursor_sharing' 'true')
      OPT_PARAM('_optimizer_extended_cursor_sharing_rel' 'simple')
      OPT_PARAM('_optimizer_rownum_bind_default' 10)
      OPT_PARAM('_optimizer_group_by_placement' 'true')
      OPT_PARAM('_optimizer_multi_level_push_pred' 'true')
      OPT_PARAM('_optimizer_distinct_elimination' 'true')
      OPT_PARAM('_px_ual_serial_input' 'true')
      OPT_PARAM('_bloom_pruning_enabled' 'true')
      OPT_PARAM('_first_k_rows_dynamic_proration' 'true')
      OPT_PARAM('_replace_virtual_columns' 'true')
      OPT_PARAM('_px_minus_intersect' 'true')
      OPT_PARAM('_globalindex_pnum_filter_enabled' 'true')
      OPT_PARAM('_gby_hash_aggregation_enabled' 'true')
      OPT_PARAM('_optimizer_connect_by_cost_based' 'true')
      OPT_PARAM('_optimizer_complex_pred_selectivity' 'true')
      OPT_PARAM('_optimizer_star_tran_in_with_clause' 'true')
      OPT_PARAM('_dimension_skip_null' 'true')
      OPT_PARAM('_selfjoin_mv_duplicates' 'true')
      OPT_PARAM('_optimizer_outer_to_anti_enabled' 'true')
      OPT_PARAM('_optimizer_order_by_elimination_enabled' 'true')
      OPT_PARAM('_optimizer_or_expansion' 'depth')
      OPT_PARAM('_optimizer_better_inlist_costing' 'all')
      OPT_PARAM('_optimizer_rownum_pred_based_fkr' 'true')
      OPT_PARAM('_optimizer_filter_pred_pullup' 'true')
      OPT_PARAM('_optimizer_enhanced_filter_push' 'true')
      OPT_PARAM('_optimizer_cbqt_no_size_restriction' 'true')
      OPT_PARAM('_optimizer_join_elimination_enabled' 'true')
      OPT_PARAM('_px_pwg_enabled' 'true')
      OPT_PARAM('_optimizer_transitivity_retain' 'true')
      OPT_PARAM('_optimizer_cost_hjsmj_multimatch' 'true')
      OPT_PARAM('_optimizer_extended_cursor_sharing' 'udo')
      OPT_PARAM('_bloom_filter_enabled' 'true')
      OPT_PARAM('_sql_model_unfold_forloops' 'run_time')
      OPT_PARAM('_optimizer_extend_jppd_view_types' 'true')
      OPT_PARAM('_optimizer_null_aware_antijoin' 'true')
      OPT_PARAM('_optimizer_push_pred_cost_based' 'true')
      OPT_PARAM('_optimizer_join_order_control' 3)
      OPT_PARAM('_optimizer_correct_sq_selectivity' 'true')
      OPT_PARAM('_query_rewrite_setopgrw_enable' 'true')
      OPT_PARAM('_push_join_union_view2' 'true')
      OPT_PARAM('_optimizer_compute_index_stats' 'true')
      OPT_PARAM('_optimizer_dim_subq_join_sel' 'true')
      OPT_PARAM('_mmv_query_rewrite_enabled' 'true')
      OPT_PARAM('_optimizer_join_sel_sanity_check' 'true')
      OPT_PARAM('_optimizer_squ_bottomup' 'true')
      OPT_PARAM('_right_outer_hash_enable' 'true')
      OPT_PARAM('_optimizer_cost_based_transformation' 'linear')
      OPT_PARAM('_local_communication_costing_enabled' 'true')
      OPT_PARAM('_remove_aggr_subquery' 'true')
      OPT_PARAM('optimizer_dynamic_sampling' 2)
      OPT_PARAM('query_rewrite_enabled' 'true')
      OPT_PARAM('_partition_view_enabled' 'true')
      OPT_PARAM('_optimizer_undo_cost_change' '11.2.0.1')
      DB_VERSION('11.2.0.1')
      OPTIMIZER_FEATURES_ENABLE('9.2.0')
      IGNORE_OPTIM_EMBEDDED_HINTS
      END_OUTLINE_DATA
  */

Note
-----
   - dynamic sampling used for this statement (level=2)

155 rows selected.

Everything is OK with the first plan. The second plan is not what I’ve expected: it contains HASH GROUP BY and says that dynamic sampling was used – both of them were introduced in 10g. Outline Data section is really huge in the 2nd plan. But look at the very end of it: there’s a hint to set OPTIMIZER_FEATURES_ENABLE to the requested 9.2.0 level! Combined with numerous OPT_PARAMs modifying many CBO parameters to the settings which are available in 10g/11g only (for ex., hash aggregation, ORDER BY elimination, etc.) – this is most likely a bug.

Anyway, since OPT_PARAM for OPTIMIZER_FEATURES_ENABLE is not supported, you have no other choice as to use an undocumented hint OPTIMIZER_FEATURES_ENABLE. It works as expected (and BTW shorter :-) ):

explain plan for
select /*+ optimizer_features_enable('9.2.0') */
    object_type, count(*)
  from t
 group by object_type;

Explained.

SQL> select * from table(dbms_xplan.display(null,null,'outline'));

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 1476560607

-----------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes | Cost  |
-----------------------------------------------------------
|   0 | SELECT STATEMENT   |      |  5718 | 62898 |    23 |
|   1 |  SORT GROUP BY     |      |  5718 | 62898 |    23 |
|   2 |   TABLE ACCESS FULL| T    |  5718 | 62898 |    12 |
-----------------------------------------------------------

Outline Data
-------------

  /*+
      BEGIN_OUTLINE_DATA
      FULL(@"SEL$1" "T"@"SEL$1")
      OUTLINE_LEAF(@"SEL$1")
      ALL_ROWS
      DB_VERSION('11.2.0.1')
      OPTIMIZER_FEATURES_ENABLE('9.2.0')
      IGNORE_OPTIM_EMBEDDED_HINTS
      END_OUTLINE_DATA
  */

Note
-----
   - cpu costing is off (consider enabling it)

Posted in CBO, Hints, Oracle Tagged: 10g, 11g, bug, optimizer_features_enable, opt_param

Edition name as a property for JDBC thin client

$
0
0

A question on Edition-Based Redefinition appeared on the OTN forum:

The purpose is to try to upgrade an app in production. For most application users they will keep using the pre-upgrade app connecting to the old edition by default, while at the same time some UAT users will test out the post-upgraded app on the new edition. The question is how will the Java app connect to a user schema to use the new edition


There are many documented ways to specify Edition for an application:

  • direct ALTER SESSION call from the application itself
  • indirect ALTER SESSION call from the application; for example, in the WebLogic it is possible to specify Init SQL for pooled connections
  • AFTER LOGON trigger with some code to distinguish connections of the new, upgraded application and again – ALTER SESSION call
  • There is another more convenient way to perform the task – using property oracle.jdbc.editionName. Here is a simple demonstration:

    drop edition version2 cascade;
    alter user tim enable editions;
    create edition version2 as child of ora$base;
    import java.sql.*;
    import java.util.*;
    
    public class testEBR {
        public static void main(String[] args) throws SQLException, ClassNotFoundException {
            Class.forName("oracle.jdbc.OracleDriver");
            Properties p = new Properties();
            p.put("user", "tim");
            p.put("password", "t");
            Connection conn1 = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:test11g2", p);
            System.out.println(conn1.getMetaData().getDriverVersion());
    
            p.put("oracle.jdbc.editionName", "version2");
            Connection conn2 = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:test11g2", p);
    
            test(conn1);
            test(conn2);
        }
        public static void test(Connection conn) throws SQLException {
        	ResultSet rs = conn.createStatement().executeQuery(
        		"select sys_context('userenv', 'current_edition_name') from dual");
        	rs.next();
        	System.out.println(rs.getString(1));
        }
    }

    And the output:

    [oracle@localhost tests]$ java -classpath .:$ORACLE_HOME/jdbc/lib/ojdbc6.jar testEBR
    11.2.0.1.0
    ORA$BASE
    VERSION2

    This actually works with older 11gR1 JDBC drivers too:

    [oracle@localhost tests]$ java -classpath .:/home/oracle/Desktop/ojdbc6-11107.jar testEBR
    11.1.0.7.0-Production
    ORA$BASE
    VERSION2
    [oracle@localhost tests]$ java -classpath .:/home/oracle/Desktop/ojdbc6-11106.jar testEBR
    11.1.0.6.0-Production+
    ORA$BASE
    VERSION2
    

    The property can also be supplied as a startup argument:

    [oracle@localhost tests]$ java -classpath .:$ORACLE_HOME/jdbc/lib/ojdbc6.jar -Doracle.jdbc.editionName=version2 testEBR
    11.2.0.1.0
    VERSION2
    VERSION2

    The property isn’tdocumented yet, it is mentioned on a JDBC page only, and strangely it is claimed 11gR2 JDBC driver new feature which is obviously not true.
    I’m still concerned on the original idea of the OP – I don’t know if it’s possible to have both old and new versions of read-write application co-exist some time and I’m inclined to “no, it’s not possible in the generic case”.
    By the way, this approach does not use ALTER SESSION call, which means oracle.jdbc.editionName property is native JDBC thin driver feature.


    Filed under: JDBC, Oracle Tagged: 11g, EBR

    Extended statistics and function-based indexes

    $
    0
    0

    About a year ago I’ve discovered nice feature of Oracle 10gR2 CBO: to overcome an issue with calculated selectivity for predicates on multiple columns, it can use DISTINCT_KEYS of the available index. Couple of weeks ago the bug fix mentioned in the OTN thread actually helped to solve a performance issue of a query. And about a week ago I found that this fix doesn’t work with function-based indexes. So, this post is about it.


    A test case:

    drop table t cascade constraints purge;
    create table t as
    with g as (select /*+ materialize */ null from all_objects where rownum <= 1000)
    select rownum id,
           'x' || lpad(mod(rownum, 100), 9, '0') x,
           'y' || lpad(mod(rownum, 100), 9, '0') y
      from g g1, g g2
     where rownum <= 1e5;
    exec dbms_stats.gather_table_stats(user, 't', method_opt=>'for all columns size 1', estimate_percent=>null)
    alter session set "_fix_control"='5765456:0';
    
    create index t_indx on t(x, y);
    explain plan for select /*+ index(t t_indx) */ * from t where x = :1 and y = :2;
    @xp
    
    alter session set "_fix_control"='5765456:7';
    explain plan for select /*+ full(t) */ * from t where x = :1 and y = :2;
    @xp
    
    explain plan for select /*+ index(t t_indx) */ * from t where x = :1 and y = :2;
    @xp
    

    And excerpts of output when running it on 10.2.0.4P35 with comments

    -- defaults: good cardinality for IRS, but bad for table access
    --------------------------------------------------------------------------------------
    | Id  | Operation                   | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |        |    10 |   260 |   449   (0)| 00:00:06 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T      |    10 |   260 |   449   (0)| 00:00:06 |
    |*  2 |   INDEX RANGE SCAN          | T_INDX |  1000 |       |     7   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("X"=:1 AND "Y"=:2)
    
    -- enabled fix for bug 5765456 and FTS: all OK
    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |  1000 | 26000 |   103   (1)| 00:00:02 |
    |*  1 |  TABLE ACCESS FULL| T    |  1000 | 26000 |   103   (1)| 00:00:02 |
    --------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter("X"=:1 AND "Y"=:2)
    
    -- enabled fix for bug 5765456 and IRS: all OK too
    --------------------------------------------------------------------------------------
    | Id  | Operation                   | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |        |  1000 | 26000 |   449   (0)| 00:00:06 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T      |  1000 | 26000 |   449   (0)| 00:00:06 |
    |*  2 |   INDEX RANGE SCAN          | T_INDX |  1000 |       |     7   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("X"=:1 AND "Y"=:2)
    

    Now let’s add a function-based index and try similar queries:

    create index t_indx2 on t(x, upper(y));
    exec dbms_stats.gather_table_stats(user, 't', method_opt=>'for all hidden columns size 1', estimate_percent=>null)
    
    explain plan for select /*+ full(t) */ * from t where x = :1 and upper(y) = :2;
    @xp
    
    explain plan for select /*+ index(t t_indx2) */ * from t where x = :1 and upper(y) = :2;
    @xp
    

    Oops:

    -- enabled fix for bug 5765456 and FTS: wrong estimates
    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |    10 |   270 |   103   (1)| 00:00:02 |
    |*  1 |  TABLE ACCESS FULL| T    |    10 |   270 |   103   (1)| 00:00:02 |
    --------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter("X"=:1 AND UPPER("Y")=:2)
    
    -- -- enabled fix for bug 5765456 and IRS: wrong estimates for table access
    ---------------------------------------------------------------------------------------
    | Id  | Operation                   | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |         |    10 |   270 |   449   (0)| 00:00:06 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T       |    10 |   270 |   449   (0)| 00:00:06 |
    |*  2 |   INDEX RANGE SCAN          | T_INDX2 |  1000 |       |     7   (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("X"=:1 AND UPPER("Y")=:2)
    

    So, 10.2.0.4 is not good in this scenario. What about 11.2.0.1 (Win32)?

    --------------------------------------------------------------------------------------
    | Id  | Operation                   | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |        |  1000 | 27000 |   449   (0)| 00:00:06 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T      |  1000 | 27000 |   449   (0)| 00:00:06 |
    |*  2 |   INDEX RANGE SCAN          | T_INDX |  1000 |       |     7   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("X"=:1 AND "Y"=:2)
    
    -- fix 5765456 can't be disabled in 11.2.0.1
    ERROR:
    ORA-02097: parameter cannot be modified because specified value is invalid
    ORA-00940: invalid ALTER command
    
    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |  1000 | 27000 |   127   (1)| 00:00:02 |
    |*  1 |  TABLE ACCESS FULL| T    |  1000 | 27000 |   127   (1)| 00:00:02 |
    --------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter("X"=:1 AND "Y"=:2)
    
    --------------------------------------------------------------------------------------
    | Id  | Operation                   | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |        |  1000 | 27000 |   449   (0)| 00:00:06 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T      |  1000 | 27000 |   449   (0)| 00:00:06 |
    |*  2 |   INDEX RANGE SCAN          | T_INDX |  1000 |       |     7   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("X"=:1 AND "Y"=:2)
    
    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |  1000 | 38000 |   127   (1)| 00:00:02 |
    |*  1 |  TABLE ACCESS FULL| T    |  1000 | 38000 |   127   (1)| 00:00:02 |
    --------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter("X"=:1 AND UPPER("Y")=:2)
    
    ---------------------------------------------------------------------------------------
    | Id  | Operation                   | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |         |  1000 | 38000 |   449   (0)| 00:00:06 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T       |  1000 | 38000 |   449   (0)| 00:00:06 |
    |*  2 |   INDEX RANGE SCAN          | T_INDX2 |  1000 |       |     7   (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("X"=:1 AND UPPER("Y")=:2)
    

    So in 11.2.0.1:

    • bug fix 5765456 is enabled by default and can’t be disabled
    • in all cases Oracle calculates cardinality estimate properly

    - it’s great, but requires an index (though you can make it unusable and save associated overheads). When I tried to use pure extended statistics in 11.2.0.1, I’ve encountered several issues. I’m copy-pasting output with comments

    -- adding virtual column with the same function as in existing function-based index fails
    SQL> alter table t add (upper_y as (upper(y)));
    alter table t add (upper_y as (upper(y)))
                       *
    ERROR at line 1:
    ORA-54015: Duplicate column expression was specified
    
    SQL> drop table t cascade constraints purge;
    
    Table dropped.
    
    SQL> create table t as
      2  with g as (select /*+ materialize */ null from all_objects where rownum <= 1000)
      3  select rownum id,
      4         'x' || lpad(mod(rownum, 100), 9, '0') x,
      5         'y' || lpad(mod(rownum, 100), 9, '0') y
      6    from g g1, g g2
      7   where rownum <= 1e5;
    
    Table created.
    
    SQL> alter table t add (upper_y as (upper(y)));
    
    Table altered.
    
    SQL> select column_name, hidden_column, virtual_column, avg_col_len from user_tab_cols where table_name = 'T';
    
    COLUMN_NAME                    HID VIR          AVG_COL_LEN
    ------------------------------ --- --- --------------------
    UPPER_Y                        NO  YES NULL
    Y                              NO  NO  NULL
    X                              NO  NO  NULL
    ID                             NO  NO  NULL
    
    4 rows selected.
    -- can't gather statistics on virtual column explicitly
    SQL> exec dbms_stats.gather_table_stats(user, 't', method_opt=>'for all virtual columns size 1', estimate_percent=>null)
    BEGIN dbms_stats.gather_table_stats(user, 't', method_opt=>'for all virtual columns size 1', estimate_percent=>null); END;
    
    *
    ERROR at line 1:
    ORA-20000: Cannot parse for clause: for all virtual columns size 1
    ORA-06512: at "SYS.DBMS_STATS", line 20337
    ORA-06512: at "SYS.DBMS_STATS", line 20360
    ORA-06512: at line 1
    
    
    SQL> exec dbms_stats.gather_table_stats(user, 't', method_opt=>'for virtual columns size 1', estimate_percent=>null)
    BEGIN dbms_stats.gather_table_stats(user, 't', method_opt=>'for virtual columns size 1', estimate_percent=>null); END;
    
    *
    ERROR at line 1:
    ORA-20000: Cannot parse for clause: for virtual columns size 1
    ORA-06512: at "SYS.DBMS_STATS", line 20337
    ORA-06512: at "SYS.DBMS_STATS", line 20360
    ORA-06512: at line 1
    
    -- and can't add extended statistics:
    SQL> select dbms_stats.create_extended_stats(user, 't', '(upper_y)') from dual;
    select dbms_stats.create_extended_stats(user, 't', '(upper_y)') from dual
           *
    ERROR at line 1:
    ORA-20001: Invalid Extension: Not an expression
    
    
    SQL> select dbms_stats.create_extended_stats(user, 't', '(upper(y))') from dual;
    select dbms_stats.create_extended_stats(user, 't', '(upper(y))') from dual
           *
    ERROR at line 1:
    ORA-20007: extension (upper(y)) already exists in the table
    ORA-06512: at "SYS.DBMS_STATS", line 6674
    ORA-06512: at "SYS.DBMS_STATS", line 28195
    
    -- because virtual column added it behind the scene already:
    SQL> select extension_name, extension
      2  from user_stat_extensions
      3  /
    
    EXTENSION_NAME
    ------------------------------
    EXTENSION
    -------------------------------------
    UPPER_Y
    (UPPER("Y"))
    
    -- OK then, now back to the main topic - FBI and statistics:
    SQL> select dbms_stats.create_extended_stats(user, 't', '(x, upper_y)') from dual;
    select dbms_stats.create_extended_stats(user, 't', '(x, upper_y)') from dual
           *
    ERROR at line 1:
    ORA-20001: Error when processing extension -  virtual column is referenced in a column expression
    ORA-06512: at "SYS.DBMS_STATS", line 6815
    ORA-06512: at "SYS.DBMS_STATS", line 28195
    
    SQL> select dbms_stats.create_extended_stats(user, 't', '(x, upper(y))') from dual
      2  /
    select dbms_stats.create_extended_stats(user, 't', '(x, upper(y))') from dual
           *
    ERROR at line 1:
    ORA-20001: Invalid Extension: Column group can contain only columns seperated by comma
    

    Yes, I wasn’t able to make extended statistics work in case of an expression. And yes, last exception has a typo and this is not my mistake.
    If you know how to make it work in 11g – don’t hesitate to leave a comment.


    Filed under: CBO, Oracle Tagged: 10.2.0.4, 10gR2, 11g, FBI, indexes, statistics

    ORDER BY

    $
    0
    0

    This is a quick note on the importance of ORDER BY for the order of the result set produced by a SELECT. The mantra is very simple:

    Without an order_by_clause, no guarantee exists that the same query executed more than once will retrieve rows in the same order.

    Repeat it as necessary many times everywhere, because it’s true (Update: but see the first comment from Sokrates for an exception to the rule). I want to say it again because yesterday I’ve seen it in action. A query that has been working correctly for several years without an issue has started to randomly return rows without an expected order. The query looks like this:

    select ...
      from (select ...
              from t
              where ...
             order by col1
           ) t1
         , t2
     where t1.id = t2.id;
    

    i.e. it joins an inline view with another table on the primary key column. It worked well before 11g due to the fact that t2 was always joined using nested loops. However, after an upgrade the CBO has decided to use nested loops join batching which causes the order of rows to change when the data is on disk. That’s it – the query starts to return “unordered” result set sometimes, which in fact doesn’t have to be ordered. I also recommend to read Doc 378254.1 Order of the resultset changes when using a different version/patchset.


    Filed under: CBO, Oracle, SQL Tagged: 11g, CBO, nested loops

    JIT

    $
    0
    0

    Starting with Oracle 11gR1 Oracle JVM includes Just-in-Time compiler. Its goal is to convert JVM bytecode into platform-specific native code based on the performance data gathered in run-time. It is stated in the documentation that JIT “enables much faster execution” – and this is, in general, true. There are ways to control the behavior of JIT, one way is described in the MOS Doc ID 1309858.1, and another one here.

    Actually the way to control JIT (apart from completely disabling it with JAVA_JIT_ENABLED), is mentioned in the documentation – it is the new method, SET_NATIVE_COMPILER_OPTION in the DBMS_JAVA package. Unfortunately there’s no any information on what are possible incoming values to the procedure and their meaning. It looks like they are documented in the function DBMS_JAVA.NATIVE_COMPILER_OPTIONS. The way the function is implemented looks very odd to me, so I wrote a query to transform the returned table of VARCHAR2 into more readable/”query-able” form:

    col option_name         format a35
    col opt_desc            format a40 word_wrap
    col opt_values          format a30 word_wrap
    col opt_format          format a40 word_wrap
    
    select option_name,
           opt_desc,
           opt_values,
           opt_format
      from
       (select nvl(option_name, (lag(option_name ignore nulls) over (order by rn))) option_name,
               start_of_group,
               listagg(line, chr(10)) within group (order by rn) over (partition by gr) full_line
          from 
           (select case when start_of_group = 1 then
                       trim(both '''' from substr(line, instr(line, '''')))
                   end option_name,
                   nvl(start_of_group, (lag(start_of_group ignore nulls) over (order by rn))) start_of_group,
                   sum(start_of_group) over (order by rn) gr,
                   line,
                   rn
              from
               (select case when option_line like 'Option %''' then 1
                            when option_line like 'Values:%'   then 2
                            when option_line like 'Format:%'   then 3
                       end start_of_group,
                       option_line line,
                       rownum rn
                  from table(dbms_java.native_compiler_options) t
                 where t.option_line is not null
                )
            )
        )
     pivot (max(full_line) for start_of_group in (1 as opt_desc, 2 as opt_values, 3 as opt_format))
     order by option_name;
    

    And here is query output from my Oracle 11.2.0.2 instance

    OPTION_NAME                         OPT_DESC                                 OPT_VALUES                     OPT_FORMAT
    ----------------------------------- ---------------------------------------- ------------------------------ ----------------------------------------
    asyncPollLevel                      Option 'asyncPollLevel'                  Values:                        Format:
                                        Level of polling used by generated code. SysEventsOnly - Poll on        'asyncPollLevel', '<value>'
                                        Asycynchronous events (such as Ctrl-C    System-events (such as GC)
                                        interrupt) are polled for in             only.  This is default.
                                        compiled code.  This option specifies    MethodEntry - Poll on each
                                        how compiled-code should poll            method-entry.
                                        for these events.                        MethodEntryAndBranches - Poll
                                                                                 on each method-entry and
                                                                                 backwards-branch.
    
    cpuFeatureFlagOverride              Option 'cpuFeatureFlagOverride'          Values: [int]                  Format:
                                        override the value of the current                                       'cpuFeatureFlagOverride', '<value>'
                                        cpu-feature flags
    
    debugAssertLevel                    Option 'debugAssertLevel'                Values:                        Format:
                                        Level of debugging assertions used by    None - No assertions.  This is 'debugAssertLevel', '<value>'
                                        the compiler.                            default.
                                                                                 Minimal - Minimal assertions.
                                                                                 All - All assertions.
    
    debugPrettyPrintMIR                 Option 'debugPrettyPrintMIR'             Values: { true, false }        Format:
                                        Pretty-print before/after MIR graphs                                    'debugPrettyPrintMIR', '<value>'
    
    debugPrintAnnotatedAsm              Option 'debugPrintAnnotatedAsm'          Values: { true, false }        Format:
                                        Print annotated assembly listing for                                    'debugPrintAnnotatedAsm', '<value>'
                                        generated code
    
    debugPrintBytecodes                 Option 'debugPrintBytecodes'             Values: { true, false }        Format:
                                        Print the input bytecodes                                               'debugPrintBytecodes', '<value>'
    
    debugPrintClonedMIR                 Option 'debugPrintClonedMIR'             Values: { true, false }        Format:
                                        Print Cloned MIR.                                                       'debugPrintClonedMIR', '<value>'
    
    debugPrintGCMap                     Option 'debugPrintGCMap'                 Values: { true, false }        Format:
                                        Print the GC Map                                                        'debugPrintGCMap', '<value>'
    
    debugPrintHeapSSAAfterRepairSSA     Option 'debugPrintHeapSSAAfterRepairSSA' Values: { true, false }        Format:
                                        Print Heap-SSA after repair-SSA.                                        'debugPrintHeapSSAAfterRepairSSA',
                                                                                                                '<value>'
    
    debugPrintHeapSSAAfterToSSA         Option 'debugPrintHeapSSAAfterToSSA'     Values: { true, false }        Format:
                                        Print Heap-SSA after SSA conversion.                                    'debugPrintHeapSSAAfterToSSA', '<value>'
    
    
    debugPrintHeapSSABeforeLSE          Option 'debugPrintHeapSSABeforeLSE'      Values: { true, false }        Format:
                                        Print HeapSSA before Load-Store                                         'debugPrintHeapSSABeforeLSE', '<value>'
                                        Elimination.
    
    debugPrintLIRAfterToLIR             Option 'debugPrintLIRAfterToLIR'         Values: { true, false }        Format:
                                        Print LIR after doing MIR-to-LIR                                        'debugPrintLIRAfterToLIR', '<value>'
                                        conversion.
    
    debugPrintLIRPseudoBlocks           Option 'debugPrintLIRPseudoBlocks'       Values: { true, false }        Format:
                                        Print LIR pseudo blocks when printing                                   'debugPrintLIRPseudoBlocks', '<value>'
                                        LIR.
    
    debugPrintLSEIPLattice              Option 'debugPrintLSEIPLattice'          Values: { true, false }        Format:
                                        Print Load-Store Elimination                                            'debugPrintLSEIPLattice', '<value>'
                                        Index-propagation Lattice.
    
    debugPrintMIRAfterABCD              Option 'debugPrintMIRAfterABCD'          Values: { true, false }        Format:
                                        Print MIR after Array Bounds-Check                                      'debugPrintMIRAfterABCD', '<value>'
                                        removal.
    
    debugPrintMIRAfterBranchSimplificat Option                                   Values: { true, false }        Format:
    ion                                 'debugPrintMIRAfterBranchSimplification'                                'debugPrintMIRAfterBranchSimplification'
                                        Print MIR after Branch Simplification.                                  , '<value>'
    
    debugPrintMIRAfterCFGDiamond        Option 'debugPrintMIRAfterCFGDiamond'    Values: { true, false }        Format:
                                        Print MIR after CFG Diamond Analysis.                                   'debugPrintMIRAfterCFGDiamond',
                                                                                                                '<value>'
    
    debugPrintMIRAfterFromSSA           Option 'debugPrintMIRAfterFromSSA'       Values: { true, false }        Format:
                                        Print MIR after converting out of SSA.                                  'debugPrintMIRAfterFromSSA', '<value>'
    
    debugPrintMIRAfterInlining          Option 'debugPrintMIRAfterInlining'      Values: { true, false }        Format:
                                        Print MIR after Method Inlining.                                        'debugPrintMIRAfterInlining', '<value>'
    
    debugPrintMIRAfterLSE               Option 'debugPrintMIRAfterLSE'           Values: { true, false }        Format:
                                        Print MIR after Load-Store Elimination.                                 'debugPrintMIRAfterLSE', '<value>'
    
    debugPrintMIRAfterLoopOpts          Option 'debugPrintMIRAfterLoopOpts'      Values: { true, false }        Format:
                                        Print MIR after Loop Optimizations.                                     'debugPrintMIRAfterLoopOpts', '<value>'
    
    debugPrintMIRAfterOSDTransformation Option                                   Values: { true, false }        Format:
                                        'debugPrintMIRAfterOSDTransformation'                                   'debugPrintMIRAfterOSDTransformation',
                                        Print MIR after doing platform-specific                                 '<value>'
                                        transformation.
    
    debugPrintMIRAfterRepairSSA         Option 'debugPrintMIRAfterRepairSSA'     Values: { true, false }        Format:
                                        Print MIR after repair-SSA.                                             'debugPrintMIRAfterRepairSSA', '<value>'
    
    
    debugPrintMIRAfterToSSA             Option 'debugPrintMIRAfterToSSA'         Values: { true, false }        Format:
                                        Print MIR after SSA conversion.                                         'debugPrintMIRAfterToSSA', '<value>'
    
    debugPrintMIRAfterTraceProfiles     Option 'debugPrintMIRAfterTraceProfiles' Values: { true, false }        Format:
                                        Print MIR after doing TraceProfile                                      'debugPrintMIRAfterTraceProfiles',
                                        analysis.                                                               '<value>'
    
    debugPrintMIRAfterUnfactor          Option 'debugPrintMIRAfterUnfactor'      Values: { true, false }        Format:
                                        Print MIR after unfactorization.                                        'debugPrintMIRAfterUnfactor', '<value>'
    
    debugPrintMIRBeforeABCD             Option 'debugPrintMIRBeforeABCD'         Values: { true, false }        Format:
                                        Print MIR before Array Bounds-Check                                     'debugPrintMIRBeforeABCD', '<value>'
                                        removal.
    
    debugPrintMIRBeforeBranchSimplifica Option                                   Values: { true, false }        Format:
    tion                                'debugPrintMIRBeforeBranchSimplification                                'debugPrintMIRBeforeBranchSimplification
                                        '                                                                       ', '<value>'
                                        Print MIR before Branch Simplification.
    
    debugPrintMIRBeforeCFGDiamond       Option 'debugPrintMIRBeforeCFGDiamond'   Values: { true, false }        Format:
                                        Print MIR before CFG Diamond Analysis.                                  'debugPrintMIRBeforeCFGDiamond',
                                                                                                                '<value>'
    
    debugPrintMIRBeforeFromSSA          Option 'debugPrintMIRBeforeFromSSA'      Values: { true, false }        Format:
                                        Print MIR before converting out of SSA.                                 'debugPrintMIRBeforeFromSSA', '<value>'
    
    debugPrintMIRBeforeGVN              Option 'debugPrintMIRBeforeGVN'          Values: { true, false }        Format:
                                        Print MIR before GlobalValueNumbering.                                  'debugPrintMIRBeforeGVN', '<value>'
    
    debugPrintMIRBeforeInlining         Option 'debugPrintMIRBeforeInlining'     Values: { true, false }        Format:
                                        Print MIR before Method Inlining.                                       'debugPrintMIRBeforeInlining', '<value>'
    
    
    debugPrintMIRBeforeLSE              Option 'debugPrintMIRBeforeLSE'          Values: { true, false }        Format:
                                        Print MIR before Load-Store Elimination.                                'debugPrintMIRBeforeLSE', '<value>'
    
    debugPrintMIRBeforeLoopOpts         Option 'debugPrintMIRBeforeLoopOpts'     Values: { true, false }        Format:
                                        Print MIR before Loop Optimizations.                                    'debugPrintMIRBeforeLoopOpts', '<value>'
    
    
    debugPrintMIRBeforeOSDTransformatio Option                                   Values: { true, false }        Format:
    n                                   'debugPrintMIRBeforeOSDTransformation'                                  'debugPrintMIRBeforeOSDTransformation',
                                        Print MIR before doing platform-specific                                '<value>'
                                        transformation.
    
    debugPrintMIRBeforeRepairSSA        Option 'debugPrintMIRBeforeRepairSSA'    Values: { true, false }        Format:
                                        Print MIR before repair-SSA.                                            'debugPrintMIRBeforeRepairSSA',
                                                                                                                '<value>'
    
    debugPrintMIRBeforeToSSA            Option 'debugPrintMIRBeforeToSSA'        Values: { true, false }        Format:
                                        Print MIR before SSA conversion.                                        'debugPrintMIRBeforeToSSA', '<value>'
    
    debugPrintMIRBeforeTraceProfiles    Option                                   Values: { true, false }        Format:
                                        'debugPrintMIRBeforeTraceProfiles'                                      'debugPrintMIRBeforeTraceProfiles',
                                        Print MIR before doing TraceProfile                                     '<value>'
                                        analysis.
    
    debugPrintMIRBeforeUnfactor         Option 'debugPrintMIRBeforeUnfactor'     Values: { true, false }        Format:
                                        Print MIR before unfactorization.                                       'debugPrintMIRBeforeUnfactor', '<value>'
    
    
    debugTraceDataFlowSolver            Option 'debugTraceDataFlowSolver'        Values: { true, false }        Format:
                                        Trace the dataflow solver                                               'debugTraceDataFlowSolver', '<value>'
    
    debugTraceLevel                     Option 'debugTraceLevel'                 Values:                        Format:
                                        Level of debugging trace used by the     None - No debugging.  This is  'debugTraceLevel', '<value>'
                                        compiler.                                default.
                                                                                 Minimal - Minimal debugging.
                                                                                 OptimizationsSummary - Minimal
                                                                                 debugging and summarize
                                                                                 optimizer decisions.
                                                                                 OptimizationsDetail - Minimal
                                                                                 debugging and detail optimizer
                                                                                 decisions.
                                                                                 Verbose - Verbose debugging.
                                                                                 All - All debugging.
    
    exclude                             Option 'exclude'                                                        Format:
                                        Exclude method from compilation.                                        'exclude', 'java.util.Hashtable'
                                                                                                                'exclude',
                                                                                                                'java.util.Hashtable.get(java.lang.Objec
                                                                                                                t)'
                                                                                                                'exclude',
                                                                                                                'java.util.Hashtable.get(java.lang.Objec
                                                                                                                t) return java.lang.Object'
                                                                                                                'exclude',
                                                                                                                'java/util/Hashtable.get(Ljava/lang/Obje
                                                                                                                ct;)Ljava/lang/Object;
                                                                                                                Java Virtual-Machine Specification style
                                                                                                                method signatures,
                                                                                                                javap-style method signatures and
                                                                                                                call-spec style method signatures are
                                                                                                                all
                                                                                                                accepted.
                                                                                                                If no method name/signature is given,
                                                                                                                all methods in the indicated class
                                                                                                                will be excluded
    
    optimizerAnnotationConstraints      Option 'optimizerAnnotationConstraints'  Values: { true, false }        Format:
                                        Enable annotated class constraints.                                     'optimizerAnnotationConstraints',
                                                                                                                '<value>'
    
    optimizerBatchWKExceptions          Option 'optimizerBatchWKExceptions'      Values: { true, false }        Format:
                                        Enable batching of well-known (implicit)                                'optimizerBatchWKExceptions', '<value>'
                                        exception throws.
    
    optimizerBoundsCheckRemoval         Option 'optimizerBoundsCheckRemoval'     Values: { true, false }        Format:
                                        Enable array bounds-check removal                                       'optimizerBoundsCheckRemoval', '<value>'
                                        optimization.
    
    optimizerBoundsCheckRemovalSubtract Option                                   Values: { true, false }        Format:
    ionVertices                         'optimizerBoundsCheckRemovalSubtractionV                                'optimizerBoundsCheckRemovalSubtractionV
                                        ertices'                                                                ertices', '<value>'
                                        Enable subtraction vertices in array
                                        bounds-check removal.
    
    optimizerBranchElimination          Option 'optimizerBranchElimination'      Values: { true, false }        Format:
                                        Enable branch-elimination optimization.                                 'optimizerBranchElimination', '<value>'
    
    optimizerBranchSimplification       Option 'optimizerBranchSimplification'   Values: { true, false }        Format:
                                        Enable branch-simplification                                            'optimizerBranchSimplification',
                                        optimization.                                                           '<value>'
    
    optimizerCombineDivMod              Option 'optimizerCombineDivMod'          Values: { true, false }        Format:
                                        Enable combination of div and mod                                       'optimizerCombineDivMod', '<value>'
                                        operations.
    
    optimizerCommonSubexpressionElimina Option                                   Values: { true, false }        Format:
    tion                                'optimizerCommonSubexpressionElimination                                'optimizerCommonSubexpressionElimination
                                        '                                                                       ', '<value>'
                                        Enable common-subexpression elimination
                                        optimization.
    
    optimizerConditionalMoves           Option 'optimizerConditionalMoves'       Values: { true, false }        Format:
                                        Enable analysis of CFG diamonds                                         'optimizerConditionalMoves', '<value>'
                                        (conditional move optimization).
    
    optimizerConstantFolding            Option 'optimizerConstantFolding'        Values: { true, false }        Format:
                                        Enable constant-folding optimization.                                   'optimizerConstantFolding', '<value>'
    
    optimizerCopyPropagation            Option 'optimizerCopyPropagation'        Values: { true, false }        Format:
                                        Enable copy-propagation optimization.                                   'optimizerCopyPropagation', '<value>'
    
    optimizerDeadCodeElimination        Option 'optimizerDeadCodeElimination'    Values: { true, false }        Format:
                                        Enable dead-code elimination                                            'optimizerDeadCodeElimination',
                                        optimization.                                                           '<value>'
    
    optimizerEagerlyCompileForInlining  Option                                   Values: { true, false }        Format:
                                        'optimizerEagerlyCompileForInlining'                                    'optimizerEagerlyCompileForInlining',
                                        Enable eager inlining-driven                                            '<value>'
                                        compilation.
    
    optimizerExceptionTraceHandling     Option 'optimizerExceptionTraceHandling' Values: { true, false }        Format:
                                        Enable analysis of exception-trace                                      'optimizerExceptionTraceHandling',
                                        usages to suppress unnecessary                                          '<value>'
                                        backtraces.
    
    optimizerHnumConditionalMethodInlin Option                                   Values: { true, false }        Format:
    ing                                 'optimizerHnumConditionalMethodInlining'                                'optimizerHnumConditionalMethodInlining'
                                        Enable hierarchy-number conditional                                     , '<value>'
                                        method-inlining.
    
    optimizerInlineExceptionalMethods   Option                                   Values: { true, false }        Format:
                                        'optimizerInlineExceptionalMethods'                                     'optimizerInlineExceptionalMethods',
                                        Enable inlining of methods that may                                     '<value>'
                                        potentially throw exceptions.
    
    optimizerInlineExternalMethods      Option 'optimizerInlineExternalMethods'  Values: { true, false }        Format:
                                        Enable inlining of methods from other                                   'optimizerInlineExternalMethods',
                                        classes.                                                                '<value>'
    
    optimizerInlineInternedStrings      Option 'optimizerInlineInternedStrings'  Values: { true, false }        Format:
                                        Enable inlining of pointers to interned                                 'optimizerInlineInternedStrings',
                                        strings.                                                                '<value>'
    
    optimizerInlineNonLeafMethods       Option 'optimizerInlineNonLeafMethods'   Values: { true, false }        Format:
                                        Enable inlining of methods that are not                                 'optimizerInlineNonLeafMethods',
                                        leaf methods.                                                           '<value>'
    
    optimizerLoadStoreElimination       Option 'optimizerLoadStoreElimination'   Values: { true, false }        Format:
                                        Enable load-store elimination                                           'optimizerLoadStoreElimination',
                                        optimization.                                                           '<value>'
    
    optimizerLoopLICMOptimization       Option 'optimizerLoopLICMOptimization'   Values: { true, false }        Format:
                                        Enable loop LICM optimization.                                          'optimizerLoopLICMOptimization',
                                                                                                                '<value>'
    
    optimizerLoopPagedConversion        Option 'optimizerLoopPagedConversion'    Values: { true, false }        Format:
                                        Enable paged loop conversion.                                           'optimizerLoopPagedConversion',
                                                                                                                '<value>'
    
    optimizerLoopUnrollOptimization     Option 'optimizerLoopUnrollOptimization' Values: { true, false }        Format:
                                        Enable loop Unroll optimization.                                        'optimizerLoopUnrollOptimization',
                                                                                                                '<value>'
    
    optimizerMethodInlining             Option 'optimizerMethodInlining'         Values: { true, false }        Format:
                                        Enable method-inlining.                                                 'optimizerMethodInlining', '<value>'
    
    optimizerOperationCombining         Option 'optimizerOperationCombining'     Values: { true, false }        Format:
                                        Enable combining of intermediate                                        'optimizerOperationCombining', '<value>'
                                        representation operations
    
    optimizerPartialRedundancyEliminati Option                                   Values: { true, false }        Format:
    on                                  'optimizerPartialRedundancyElimination'                                 'optimizerPartialRedundancyElimination',
                                        Enable partial redundancy elimination                                   '<value>'
                                        optimization.
    
    optimizerSlowpathsOOL               Option 'optimizerSlowpathsOOL'           Values: { true, false }        Format:
                                        Enable out-of-line generation of                                        'optimizerSlowpathsOOL', '<value>'
                                        slow-paths for implicit checks.
    
    optimizerStrengthReduction          Option 'optimizerStrengthReduction'      Values: { true, false }        Format:
                                        Enable strength-reduction optimizations.                                'optimizerStrengthReduction', '<value>'
    
    optimizerThrowConversion            Option 'optimizerThrowConversion'        Values: { true, false }        Format:
                                        Enable conversion of local exception                                    'optimizerThrowConversion', '<value>'
                                        throws to local jumps.
    
    optimizerTypePropagation            Option 'optimizerTypePropagation'        Values: { true, false }        Format:
                                        Enable type-propagation.                                                'optimizerTypePropagation', '<value>'
    
    optimizerUseAclintCache             Option 'optimizerUseAclintCache'         Values: { true, false }        Format:
                                        Enable use of aclint-cache.                                             'optimizerUseAclintCache', '<value>'
    
    optimizerUseFastcalls               Option 'optimizerUseFastcalls'           Values: { true, false }        Format:
                                        Enable use of fastcalls when available.                                 'optimizerUseFastcalls', '<value>'
    
    optimizerWellKnownMethods           Option 'optimizerWellKnownMethods'       Values: { true, false }        Format:
                                        Enable substitution of well-known method                                'optimizerWellKnownMethods', '<value>'
                                        implementations.
    
    regallocCoalesceSpillLoadsStores    Option                                   Values: { true, false }        Format:
                                        'regallocCoalesceSpillLoadsStores'                                      'regallocCoalesceSpillLoadsStores',
                                        Enable register allocator to                                            '<value>'
                                        aggressively coalesce spill loads and
                                        stores.
    
    regallocGenerateGCMaps              Option 'regallocGenerateGCMaps'          Values: { true, false }        Format:
                                        Enable register allocator to generate GC                                'regallocGenerateGCMaps', '<value>'
                                        maps for precise GC.
    
    regallocPartitionRegisters          Option 'regallocPartitionRegisters'      Values: { true, false }        Format:
                                        Register allocator should partition                                     'regallocPartitionRegisters', '<value>'
                                        registers according to whether or not
                                        live-ranges span callsites.
    
    scheduleInstructions                Option 'scheduleInstructions'            Values: { true, false }        Format:
                                        Enable instruction scheduler.                                           'scheduleInstructions', '<value>'
    
    
    79 rows selected.
    

    As you can see, some of the options look almost self-explanatory, like optimizerMethodInlining, some of them are cryptic. Well, that’s how it is. The most useful, I think, is exclude option which can be used to disable native compilation on a per-method basis. I haven’t tried it though, so, please use it carefully on your own risk.


    Filed under: Java, Oracle, Performance Tagged: 11g, Oracle JVM