QB_NAME
语法:QB_NAME(<有效字符串>)
描述:该提示为所在查询块指定标识符,该标识符可以用于其他提示的全局格式,指定对象所在位置;查询块被引用时的格式为:@<标识符> 或者 <对象名>@<标识符>
HELLODBA.COM>exec sql_explain('select /*+full(@INV [email protected])*/* from t_tables t where exists (select /*+qb_name(inv)*/1 from t_users u where user_id = :A)', 'BASIC OUTLINE'); ? Outline Data ------------- ? ? /*+ ????? BEGIN_OUTLINE_DATA ????? … … ????? OUTLINE(@"SEL$1") ????? OUTLINE(@"INV") ????? OUTLINE_LEAF(@"SEL$1") ????? … … ????? END_OUTLINE_DATA ? */ |
DB_VERSION
语法:DB_VERSION(<数据库版本>)
描述:这应该是一个被动的概要提示,指明该语句子游标的执行计划解析时的数据库版本。有助于定位因升级(如从11.2.0.1到11.2.0.2)而产生的SQL问题。
在任何执行计划的概要数据中都能看到该提示。
IGNORE_OPTIM_EMBEDDED_HINTS
语法:IGNORE_OPTIM_EMBEDDED_HINTS?
描述:使优化器忽视嵌入在SQL语句当中的提示————通常用于存储概要、SQL优化配置等优化器辅助数据;
HELLODBA.COM>exec sql_explain('SELECT /*+ FULL(O) IGNORE_OPTIM_EMBEDDED_HINTS */ * FROM t_objects o where object_id<:A', 'TYPICAL OUTLINE'); ? -------------------------------------------------------------------------------------------- | Id? | Operation?????????????????? | Name???????? | Rows? | Bytes | Cost (%CPU)| Time???? | -------------------------------------------------------------------------------------------- |?? 0 | SELECT STATEMENT??????????? |????????????? |? 2379 |?? 283K|??? 10?? (0)| 00:00:01 | |?? 1 |? TABLE ACCESS BY INDEX ROWID| T_OBJECTS??? |? 2379 |?? 283K|??? 10?? (0)| 00:00:01 | |*? 2 |?? INDEX RANGE SCAN ?????????| T_OBJECTS_PK |?? 428 |?????? |???? 2?? (0)| 00:00:01 | -------------------------------------------------------------------------------------------- |
IGNORE_WHERE_CLAUSE
语法:IGNORE_WHERE_CLAUSE
描述:该提示会导致优化器忽略在其之后的其它嵌入提示。在许多内部递归调用的语句(如动态采样)当中,语句中嵌入的提示都是拼接起来的。在某些情况下,Oracle不愿意一些提示其作用,该提示就会导致后续提示失效。
HELLODBA.COM>exec sql_explain('SELECT /*+ full(O) IGNORE_WHERE_CLAUSE full(u)*/ COUNT(*) from t_objects O, t_users u where o.object_id=:A and u.user_id=:B and o.owner=u.username', 'BASIC'); ? ---------------------------------------------------- | Id? | Operation???????????????????? | Name?????? | ---------------------------------------------------- |?? 0 | SELECT STATEMENT????????????? |??????????? | |?? 1 |? SORT AGGREGATE?????????????? |??????????? | |?? 2 |?? NESTED LOOPS??????????????? |??????????? | |?? 3 |??? TABLE ACCESS BY INDEX ROWID| T_USERS??? | |?? 4 |???? INDEX UNIQUE SCAN???????? | T_USERS_PK | |?? 5 |??? TABLE ACCESS FULL????????? | T_OBJECTS? | ---------------------------------------------------- |
NO_ACCESS
语法:NO_ACCESS([查询块] <视图>)
描述:表示优化器在分析某个查询块时,没有访问指定视图。即在优化该查询块时,没采用针对该视图的优化技术(如视图合并)。
HELLODBA.COM>exec sql_explain('SELECT /*+ qb_name(M) no_merge(v) */* FROM t_tables t, v_objects_sys v WHERE t.owner =v.owner and t.table_name = v.object_name AND v.status = :A', 'TYPICAL OUTLINE'); ? ------------------------------------------------------------------------------------- | Id? | Operation?????????? | Name????????? | Rows? | Bytes | Cost (%CPU)| Time???? | ------------------------------------------------------------------------------------- |? ?0 | SELECT STATEMENT??? |?????????????? | 15643 |? 5560K|?? 325?? (3)| 00:00:04 | |*? 1 |? HASH JOIN????????? |?????????????? | 15643 |? 5560K|?? 325?? (3)| 00:00:04 | |?? 2 |?? TABLE ACCESS FULL | T_TABLES????? |? 2696 |?? 634K|??? 28?? (4)| 00:00:01 | |?? 3 |?? VIEW????????????? | V_OBJECTS_SYS | 15643 |? 1878K|?? 296?? (3)| 00:00:03 | |*? 4 |??? TABLE ACCESS FULL| T_OBJECTS???? | 15643 |?? 855K|?? 296?? (3)| 00:00:03 | ------------------------------------------------------------------------------------- ? Outline Data ------------- ? ? /*+ ????? BEGIN_OUTLINE_DATA ????? … … ????? NO_ACCESS(@"M" "V"@"M") ????? FULL(@"M" "T"@"M") ????? OUTLINE(@"M") ????? OUTLINE_LEAF(@"M") ????? … … ????? END_OUTLINE_DATA ? */ |
OPTIMIZER_FEATURES_ENABLE
语法:OPTIMIZER_FEATURES_ENABLE(<版本号>)
描述:指示优化器采用某个版本的特性。版本号为一个字符串(单引号匹配),每个版本可以指定的版本号都不相同,但基本上都是向上兼容的。DEFAULT为采用当前系统默认值
HELLODBA.COM>alter session set OPTIMIZER_FEATURES_ENABLE='10.2.0.4'; ? Session altered. ? HELLODBA.COM>exec sql_explain('SELECT /*+OPTIMIZER_FEATURES_ENABLE(DEFAULT)*/ * from t_users','BASIC OUTLINE', FALSE); … … ? Outline Data ------------- ? ? /*+ ????? BEGIN_OUTLINE_DATA ????? IGNORE_OPTIM_EMBEDDED_HINTS ????? OPTIMIZER_FEATURES_ENABLE('11.2.0.1') ????? … … ????? END_OUTLINE_DATA ? */ |
OPT_PARAM
语法:OPT_PARAM(<优化参数> 调整值)
描述:设置该语句的优化环境参数。
HELLODBA.COM>exec sql_explain('SELECT /*+QB_NAME(M) OPT_PARAM(''optimizer_index_cost_adj'' 60)*/ * from t_users u where user_id<:A','BASIC OUTLINE'); … … ? Outline Data ------------- ? ? /*+ ????? BEGIN_OUTLINE_DATA ????? … … ????? OPT_PARAM('optimizer_index_cost_adj' 60) ????? … … ????? END_OUTLINE_DATA ? */ |
OUTLINE
语法:OUTLINE([<@查询块>])
描述:为查询块建立概要节点。概要节点是优化器进行语句优化时用到的数据结构。
见其它示例当中的概要数据。
OUTLINE_LEAF
语法:OUTLINE_LEAF([<@查询块>])
描述:为查询块建立概要叶子节点。叶子节点将不再做进一步查询转换优化。
示例(以下示例中,概要叶子节点的建立导致查询块中的视图不能被合并):
HELLODBA.COM>exec sql_explain('SELECT /*+ qb_name(M) OUTLINE_LEAF(@M) */* FROM t_tables t, v_objects_sys v WHERE t.owner =v.owner and t.table_name = v.object_name AND v.status = :A', 'TYPICAL OUTLINE'); ? ------------------------------------------------------------------------------------- | Id? | Operation?????????? | Name????????? | Rows? | Bytes | Cost (%CPU)| Time???? | ------------------------------------------------------------------------------------- |?? 0 | SELECT STATEMENT??? |?????????????? | 15643 |? 5560K|?? 325?? (3)| 00:00:04 | |*? 1 |? HASH JOIN????????? |?????????????? | 15643 |? 5560K|?? 325?? (3)| 00:00:04 | |?? 2 |?? TABLE ACCESS FULL | T_TABLES????? |? 2696 |?? 634K|??? 28?? (4)| 00:00:01 | |?? 3 |?? VIEW????????????? | V_OBJECTS_SYS | 15643 |? 1878K|?? 296?? (3)| 00:00:03 | |*? 4 |??? TABLE ACCESS FULL| T_OBJECTS???? | 15643 |?? 855K|?? 296?? (3)| 00:00:03 | ------------------------------------------------------------------------------------- |
RBO_OUTLINE
语法:RBO_OUTLINE
描述:指示优化器建立基于规则的概要数据结构。
?
参考至:http://www.hellodba.com/reader.php?ID=198&lang=cn
如有错误,欢迎指正