profile

SQL> declare
2 v_hints sys.sqlprof_attr;
3 begin
4 v_hints:=sys.sqlprof_attr('full(test)');
5 dbms_sqltune.import_sql_profile('select * from ovsee.test where id =1',
6 v_hints,'SQLPROFILE_NAME1',force_match=>true);
7 end;
8 /

PL/SQL procedure successfully completed.

SQL> set autotrace trace explain;
SQL> select * from ovsee.test where id =1;

Execution Plan

Plan hash value: 3230054581



| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
Time |



| 0 | SELECT STATEMENT | | 1 | 35 | 1 (0)|
00:00:01 |

| 1 | TABLE ACCESS BY INDEX ROWID| TEST | 1 | 35 | 1 (0)|
00:00:01 |

|* 2 | INDEX RANGE SCAN | IDX_TEST_ID | 1 | | 1 (0)|
00:00:01 |



Predicate Information (identified by operation id):

2 - access("ID"=1)

Note

  • dynamic sampling used for this statement (level=2)
  • SQL profile "SQLPROFILE_NAME1" used for this statement

SQL> select /+full(test)/ * from ovsee.test where id =1;

no rows selected

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

PLAN_TABLE_OUTPUT

SQL_ID gh3h5nq2zcw7d, child number 0

select /+full(test)/ * from ovsee.test where id =1

Plan hash value: 217508114


| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |

| 0 | SELECT STATEMENT | | | | 2 (100)| |

|* 1 | TABLE ACCESS FULL| TEST | 1 | 35 | 2 (0)| 00:00:01 |

Outline Data

/*+

  BEGIN_OUTLINE_DATA
  IGNORE_OPTIM_EMBEDDED_HINTS
  OPTIMIZER_FEATURES_ENABLE('11.2.0.4')
  DB_VERSION('11.2.0.4')
  OPT_PARAM('_b_tree_bitmap_plans' 'false')
  ALL_ROWS
  OUTLINE_LEAF(@"SEL$1")
  FULL(@"SEL$1" "TEST"@"SEL$1")
  END_OUTLINE_DATA

*/

Predicate Information (identified by operation id):

1 - filter("ID"=1)

Note

  • dynamic sampling used for this statement (level=2)

37 rows selected.

SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL> declare
2 v_hints sys.sqlprof_attr;
3 begin
4 v_hints:=sys.sqlprof_attr('FULL(@"SEL$1" "TEST"@"SEL$1")');
5 dbms_sqltune.import_sql_profile('select * from ovsee.test where id =1',
6 v_hints,'SQLPROFILE_NAME1',force_match=>true,replace=>true);
7 end;
8 /

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL> select * from ovsee.test where id =1;

no rows selected

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

PLAN_TABLE_OUTPUT

SQL_ID gnrk70cay86mf, child number 0

select * from ovsee.test where id =1

Plan hash value: 217508114


| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |

| 0 | SELECT STATEMENT | | | | 2 (100)| |

|* 1 | TABLE ACCESS FULL| TEST | 1 | 35 | 2 (0)| 00:00:01 |

Outline Data

/*+

  BEGIN_OUTLINE_DATA
  IGNORE_OPTIM_EMBEDDED_HINTS
  OPTIMIZER_FEATURES_ENABLE('11.2.0.4')
  DB_VERSION('11.2.0.4')
  OPT_PARAM('_b_tree_bitmap_plans' 'false')
  ALL_ROWS
  OUTLINE_LEAF(@"SEL$1")
  FULL(@"SEL$1" "TEST"@"SEL$1")
  END_OUTLINE_DATA

*/

Predicate Information (identified by operation id):

1 - filter("ID"=1)

Note

  • dynamic sampling used for this statement (level=2)
  • SQL profile SQLPROFILE_NAME1 used for this statement

38 rows selected.

SQL>

上一篇:Tolua Log跳转 xlua日志


下一篇:Oracle 11gR2 GI日常管理手册