官方文档:11G新特性SQL PLAN BASLINE 执行计划基线
什么是SQL执行计划管理?
- Set of hints 一系列的hints
- Plan hash value 执行计划的hash值
- Plan-related information 执行计划相关的信息
DECLARE
my_plans PLS_INTEGER;
BEGIN
my_plans := DBMS_SPM.LOAD_PLANS_FROM_SQLSET( sqlset_name => 'tset1');
END;
/
DECLARE
my_plans PLS_INTEGER;
BEGIN
my_plans := DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE( sql_id => '99twu5t2dn5xd');
END;
/
- SQL identifier (SQL_ID)
- SQL text (SQL_TEXT)
- One of the following attributes:
- PARSING_SCHEMA_NAME
- MODULE
- ACTION
- Uses a cost-based search method to build a best-cost plan 使用基于成本(cost-based)的寻找方法建立plan
- Tries to find a matching plan in the SQL plan baseline 尝试在sql plan baseline中查找匹配的plan
- Does either of the following depending on whether a match is found:
- If found, then the optimizer proceeds using the matched plan 如果找到合适的plan,则使用这个plan
- If not found, then the optimizer evaluates the cost of each accepted plan in the SQL plan baseline and selects the plan with the lowest cost 如果没找到匹配的plan,则会评估sql plan baseline中的各个sql plan,使用其中代价最小的plan
SET SERVEROUTPUT ON
SET LONG 10000
DECLARE
report clob;
BEGIN
report := DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE(
sql_handle => 'SYS_SQL_593bc74fca8e6738');
DBMS_OUTPUT.PUT_LINE(report);
END;
/
REPORT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Evolve SQL Plan Baseline Report
--------------------------------------------------------------------------------
Inputs:
-------
SQL_HANDLE = SYS_SQL_593bc74fca8e6738
PLAN_NAME =
TIME_LIMIT = DBMS_SPM.AUTO_LIMIT
VERIFY = YES
COMMIT = YES
Plan: SYS_SQL_PLAN_ca8e6738a57b5fc2
-----------------------------------
Plan was verified: Time used .07 seconds.
Passed performance criterion: Compound improvement ratio >= 7.32.
Plan was changed to an accepted plan.
Baseline Plan Test Plan Improv. Ratio
------------- --------- -------------
Execution Status: COMPLETE COMPLETE
Rows Processed: 40 40
Elapsed Time(ms): 23 8 2.88
CPU Time(ms): 23 8 2.88
Buffer Gets: 450 61 7.38
Disk Reads: 0 0
Direct Writes: 0 0
Fetches: 0 0
Executions: 1 1
-------------------------------------------------------------------------------
Report Summary
-------------------------------------------------------------------------------
Number of SQL plan baselines verified: 1.
Number of SQL plan baselines evolved: 1.
Hide Navigation
Search
Advanced Search
Reference
Home · Master Index · Master Glossary · Book List · Data Dictionary · SQL Keywords · Acronyms · Initialization Parameters · Error Messages
Categories
Installation
Getting Started
Administration
Application Development
Grid Computing
High Availability
Data Warehousing
Content Management and Unstructured Data
Information Integration
Security
Videos
New and changed documents
SELECT * FROM TABLE(
DBMS_XPLAN.DISPLAY_SQL_PLAN_BASELINE(
sql_handle=>'SYS_SQL_209d10fabbedc741',
format=>'basic'));
Hide Navigation
Search
Advanced Search
Reference
Home · Master Index · Master Glossary · Book List · Data Dictionary · SQL Keywords · Acronyms · Initialization Parameters · Error Messages
Categories
Installation
Getting Started
Administration
Application Development
Grid Computing
High Availability
Data Warehousing
Content Management and Unstructured Data
Information Integration
Security
Videos
New and changed documents
SQL handle: SYS_SQL_209d10fabbedc741
SQL text: select cust_last_name, amount_sold from customers c,
sales s where c.cust_id=s.cust_id and cust_year_of_birth=:yob
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Plan name: SYS_SQL_PLAN_bbedc741a57b5fc2
Enabled: YES Fixed: NO Accepted: NO Origin: AUTO-CAPTURE
----------------------------------------------------------------------------------
Plan hash value: 2776326082
----------------------------------------------------------------------------------
| Id | Operation | Name |
----------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | |
| 1 | HASH JOIN | |
| 2 | TABLE ACCESS BY INDEX ROWID | CUSTOMERS |
| 3 | BITMAP CONVERSION TO ROWIDS | |
| 4 | BITMAP INDEX SINGLE VALUE | CUSTOMERS_YOB_BIX |
| 5 | PARTITION RANGE ALL | |
| 6 | TABLE ACCESS FULL | SALES |
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Plan name: SYS_SQL_PLAN_bbedc741f554c408
Enabled: YES Fixed: NO Accepted: YES Origin: MANUAL-LOAD
----------------------------------------------------------------------------------
Plan hash value: 4115973128
----------------------------------------------------------------------------------
| Id | Operation | Name |
----------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | |
| 1 | NESTED LOOPS | |
| 2 | NESTED LOOPS | |
| 3 | TABLE ACCESS BY INDEX ROWID | CUSTOMERS |
| 4 | BITMAP CONVERSION TO ROWIDS | |
| 5 | BITMAP INDEX SINGLE VALUE | CUSTOMERS_YOB_BIX |
| 6 | PARTITION RANGE | |
| 7 | BITMAP CONVERSION TO ROWIDS | |
| 8 | BITMAP INDEX SINGLE VALUE | SALES_CUST_BIX |
| 9 | TABLE ACCESS BY LOCAL INDEX ROWID | SALES |
----------------------------------------------------------------------------------
SELECT SQL_HANDLE, PLAN_NAME, ENABLED, ACCEPTED, FIXED
FROM DBA_SQL_PLAN_BASELINES;
SQL_HANDLE PLAN_NAME ENA ACC FIX
------------------------------------------------------------------------
SYS_SQL_209d10fabbedc741 SYS_SQL_PLAN_bbedc741a57b5fc2 YES NO NO
SYS_SQL_209d10fabbedc741 SYS_SQL_PLAN_bbedc741f554c408 YES YES NO
BEGIN
DBMS_SPM.CONFIGURE('space_budget_percent',30);
END;
/
BEGIN
DBMS_SPM.CONFIGURE( 'plan_retention_weeks',105);
END;
/
BEGIN
DBMS_SPM.CREATE_STGTAB_BASELINE(
table_name => 'stage1');
END;
/
DECLARE
my_plans number;
BEGIN
my_plans := DBMS_SPM.PACK_STGTAB_BASELINE(
table_name => 'stage1',
enabled => 'yes',
creator => 'dba1');
END;
/
DECLARE
my_plans number;
BEGIN
my_plans := DBMS_SPM.UNPACK_STGTAB_BASELINE(
table_name => 'stage1',
fixed => 'yes');
END;
/
官方文档:11G新特性SQL PLAN BASLINE 执行计划基线的更多相关文章
- Oracle 11g 新特性 --SQL Plan Management 说明
Oracle 11g 新特性 --SQL Plan Management 说明 参见大神博主文章: http://blog.csdn.net/tianlesoftware/article/detail ...
- 11g新特性-SQL Plan Management
在11g之前版本,提供了stored outlines(sql概要)特性来保存sql的执行计划. 在11g中,引入了一个新的特性sql计划管理(sql plan management)特性来保存sql ...
- 《Spring5官方文档》新功能(4,3)
<Spring5官方文档>新功能 原文链接 译者:supriseli Spring框架的新功能 这一章主要提供Spring框架新的功能和变更. 升级到新版本的框架可以参考.Spring g ...
- 11g的新特性:SQL Plan Management(SPM)
Oracle11g中,Oracle提供dbms_spm包来管理SQL Plan,SPM是一个预防机制,它记录并评估sql的执行计划,将已知的高效的sql执行计划建立为SQL Plan Baseline ...
- 【pytest官方文档】解读fixtures - 11. fixture的执行顺序,3要素详解(长文预警)
当pytest要执行一个测试函数,这个测试函数还请求了fixture函数,那么这时候pytest就要先确定fixture的执行顺序了. 影响因素有三: scope,就是fixture函数的作用范围,比 ...
- Spark SQL 官方文档-中文翻译
Spark SQL 官方文档-中文翻译 Spark版本:Spark 1.5.2 转载请注明出处:http://www.cnblogs.com/BYRans/ 1 概述(Overview) 2 Data ...
- mybatis 动态 SQL 官方文档
MyBatis 的强大特性之一便是它的动态 SQL.如果你有使用 JDBC 或其它类似框架的经验,你就能体会到根据不同条件拼接 SQL 语句的痛苦.例如拼接时要确保不能忘记添加必要的空格,还要注意去掉 ...
- 入门常用SQL及官方文档的使用
SQL语句基础理论 SQL是操作和检索关系型数据库的标准语言,标准SQL语句可用于操作关系型数据库. 5大主要类型: ①DQL(Data Query Language,数据查询语言)语句,主要由于se ...
- 五个新知识:微软SHA2补丁,亚信专业工具,微软官方文档,使用过期签名(附官方推荐链接),注意使用具有UAC的CMD
五个新知识:微软SHA2补丁,亚信专业工具,微软官方文档,使用过期签名 不支持SHA2算法的计算机更新补丁:https://technet.microsoft.com/zh-CN/library/se ...
随机推荐
- Java基础——线程复习总结
线程 T ...
- 搜索框反射型xss问题解决(网站开发)
什么是反射型XSS XSS又叫CSS (Cross Site Script) ,跨站脚本攻击.它指的是恶意攻击者往Web页面里插入恶意html代码,当用户浏览该页之时,嵌入其中Web里面的h ...
- Keras模型的保存方式
Keras模型的保存方式 在运行并且训练出一个模型后获得了模型的结构与许多参数,为了防止再次训练以及需要更好地去使用,我们需要保存当前状态 基本保存方式 h5 # 此处假设model为一个已经训练好的 ...
- python核心编程2 第十章 练习
10-6.改进的open().为内建的open()函数创建一个封装.使得成功打开文件后,返回文件句柄:若打开失败则返回给调用者None, 而不是生成一个异常.这样你打开文件就不需要额外的异常处理语句. ...
- springmvc重定向请求。
SpringMVC重定向传参数的实现(来自网友) 验证了我说的,从model层中拿来的数据,不管什么类型,都是通过隐含模型,中转,放入request中的.除非你特意把这些数据放到session域中. ...
- mongodb的windows系统下安装
先下载安装包,地址有下面两个,按需选择吧. https://www.mongodb.com/download-center/v2/community https://www.mongodb.org/d ...
- 第一个网页(仿照当当网,仅仅使用CSS)
这个网页是在学过CSS之后,对当当网首页进行模仿的网页,没有看当当网的网页源码,纯按照自己之前学的写的,由于是刚学过HTML和CSS才一个星期,所以里面有许多地方写的非常没有水平,仅仅用来学习使用,欢 ...
- class实现Stack
基于class实现一个存储string类型的Stack 头文件: //stack.h #include<vector> #include<string> class Stack ...
- Unicode控制字符
Unicode控制字符就是特殊的Unicode字符 控制字符转义代码对照表 Unicode-控制字符 LRM RLM ZWJ ZWNJ LRE LRO RLO PDF NADS ...
- hadoop jar x.jar 执行过程
hadoop jar x.jar 执行过程 Yarn框架执行内容 1,job.waitforcompletion() 启动 Runjar 进程 -> Resourcemanage申请一个j ...